summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-01-09 14:32:57 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-01-09 14:33:46 -0800
commit3e200f539fd6523a26a89dd21b1c966f3e8b1486 (patch)
treec326a00eacfda90af5a56c20b6a500f35f19b9c5
parent5169f3a45fdc1737379ebf11fb8f6c91daa11d68 (diff)
Clarify that Base64 unescaping methods expect their inputs to match particular RFC specifications.
PiperOrigin-RevId: 500809781 Change-Id: I34d089343321f7658db8252ad29ff1824e6dbef2
-rw-r--r--absl/strings/escaping.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/absl/strings/escaping.h b/absl/strings/escaping.h
index d2c18e02..f47cf736 100644
--- a/absl/strings/escaping.h
+++ b/absl/strings/escaping.h
@@ -135,20 +135,21 @@ std::string WebSafeBase64Escape(absl::string_view src);
// Base64Unescape()
//
-// Converts a `src` string encoded in Base64 to its binary equivalent, writing
-// it to a `dest` buffer, returning `true` on success. If `src` contains invalid
-// characters, `dest` is cleared and returns `false`.
-// Padding is optional. If padding is included, it must be correct. In the
-// padding, '=' and '.' are treated identically.
+// Converts a `src` string encoded in Base64 (RFC 4648 section 4) to its binary
+// equivalent, writing it to a `dest` buffer, returning `true` on success. If
+// `src` contains invalid characters, `dest` is cleared and returns `false`.
+// Padding is optional, and note that `Base64Escape()` does not produce it. If
+// padding is included, it must be correct. In the padding, '=' and '.' are
+// treated identically.
bool Base64Unescape(absl::string_view src, std::string* dest);
// WebSafeBase64Unescape()
//
-// Converts a `src` string encoded in Base64 to its binary equivalent, writing
-// it to a `dest` buffer, but using '-' instead of '+', and '_' instead of '/'.
-// If `src` contains invalid characters, `dest` is cleared and returns `false`.
-// Padding is optional. If padding is included, it must be correct. In the
-// padding, '=' and '.' are treated identically.
+// Converts a `src` string encoded in "web safe" Base64 (RFC 4648 section 5) to
+// its binary equivalent, writing it to a `dest` buffer. If `src` contains
+// invalid characters, `dest` is cleared and returns `false`. If padding is
+// included, it must be correct. In the padding, '=' and '.' are treated
+// identically.
bool WebSafeBase64Unescape(absl::string_view src, std::string* dest);
// HexStringToBytes()