diff options
author | Abseil Team <absl-team@google.com> | 2022-11-21 08:00:56 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-11-21 08:01:49 -0800 |
commit | 76b7618369826ba175beed1735b6b072f5be15d8 (patch) | |
tree | e4b2173b408115b7ee155960475873510ec7d835 /absl | |
parent | 48c36b48fc7ead5a0fb6de7577780c2acf046e15 (diff) |
Document the WebSafe* and *WithPadding variants more concisely, as deltas from Base64Encode.
Also:
* Clarify that padding refers to ‘output’ padding
* Make CalculateBase64EscapedLen() a bit more discoverable
* Reference all relevant non-obsolete RFCs (2045 as well as 4648)
PiperOrigin-RevId: 489981278
Change-Id: I27365ea5d52bfdb0c9d02ed96d05b4a60f2dc36f
Diffstat (limited to 'absl')
-rw-r--r-- | absl/strings/escaping.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/absl/strings/escaping.h b/absl/strings/escaping.h index aa6d1750..e8d2912b 100644 --- a/absl/strings/escaping.h +++ b/absl/strings/escaping.h @@ -137,16 +137,17 @@ bool WebSafeBase64Unescape(absl::string_view src, std::string* dest); // Base64Escape() // -// Encodes a `src` string into a base64-encoded string, with padding characters. -// This function conforms with RFC 4648 section 4 (base64). +// Encodes a `src` string into a base64-encoded 'dest' string with padding +// characters. This function conforms with RFC 4648 section 4 (base64) and RFC +// 2045. See also CalculateBase64EscapedLen(). void Base64Escape(absl::string_view src, std::string* dest); std::string Base64Escape(absl::string_view src); // WebSafeBase64Escape() // -// Encodes a `src` string into a base64-like string, using '-' instead of '+' -// and '_' instead of '/', and without padding. This function conforms with RFC -// 4648 section 5 (base64url). +// Encodes a `src` string into a base64 string, like Base64Escape() does, but +// outputs '-' instead of '+' and '_' instead of '/', and does not pad 'dest'. +// This function conforms with RFC 4648 section 5 (base64url). void WebSafeBase64Escape(absl::string_view src, std::string* dest); std::string WebSafeBase64Escape(absl::string_view src); |