diff --git a/lib/std/crypto/codecs/base64_hex_ct.zig b/lib/std/crypto/codecs/base64_hex_ct.zig index 9e639d84bd09cb3cd8852b34d2c1e7667ec698ea..3da08ceb25989747d6984d2f4017b8009543a865 100644 --- a/lib/std/crypto/codecs/base64_hex_ct.zig +++ b/lib/std/crypto/codecs/base64_hex_ct.zig @@ -261,7 +261,7 @@ pub const base64 = struct { /// Returns the maximum possible decoded size for a given input length after skipping ignored characters. pub fn decodedLenUpperBound(b64_len: usize) usize { - return b64_len / 3 * 4; + return b64_len / 4 * 3 + (b64_len % 4) * 3 / 4; } };