Commit 76b76183 by Abseil Team Committed by Copybara-Service

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
parent 48c36b48
...@@ -137,16 +137,17 @@ bool WebSafeBase64Unescape(absl::string_view src, std::string* dest); ...@@ -137,16 +137,17 @@ bool WebSafeBase64Unescape(absl::string_view src, std::string* dest);
// Base64Escape() // Base64Escape()
// //
// Encodes a `src` string into a base64-encoded string, with padding characters. // Encodes a `src` string into a base64-encoded 'dest' string with padding
// This function conforms with RFC 4648 section 4 (base64). // 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); void Base64Escape(absl::string_view src, std::string* dest);
std::string Base64Escape(absl::string_view src); std::string Base64Escape(absl::string_view src);
// WebSafeBase64Escape() // WebSafeBase64Escape()
// //
// Encodes a `src` string into a base64-like string, using '-' instead of '+' // Encodes a `src` string into a base64 string, like Base64Escape() does, but
// and '_' instead of '/', and without padding. This function conforms with RFC // outputs '-' instead of '+' and '_' instead of '/', and does not pad 'dest'.
// 4648 section 5 (base64url). // This function conforms with RFC 4648 section 5 (base64url).
void WebSafeBase64Escape(absl::string_view src, std::string* dest); void WebSafeBase64Escape(absl::string_view src, std::string* dest);
std::string WebSafeBase64Escape(absl::string_view src); std::string WebSafeBase64Escape(absl::string_view src);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment