| ... | ... | @@ -31,6 +31,9 @@ pub const standard_alphabet_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq |
| 31 | 31 | fn standardBase64DecoderWithIgnore(ignore: []const u8) Base64DecoderWithIgnore { |
| 32 | 32 | return Base64DecoderWithIgnore.init(standard_alphabet_chars, '=', ignore); |
| 33 | 33 | } |
| 34 | fn standardNoPadBase64DecoderWithIgnore(ignore: []const u8) Base64DecoderWithIgnore { |
| 35 | return Base64DecoderWithIgnore.init(standard_alphabet_chars, null, ignore); |
| 36 | } |
| 34 | 37 | |
| 35 | 38 | /// Standard Base64 codecs, with padding, as defined in |
| 36 | 39 | /// [RFC 4648 section 4](https://datatracker.ietf.org/doc/html/rfc4648#section-4). |
| ... | ... | @@ -47,7 +50,7 @@ pub const standard = Codecs{ |
| 47 | 50 | pub const standard_no_pad = Codecs{ |
| 48 | 51 | .alphabet_chars = standard_alphabet_chars, |
| 49 | 52 | .pad_char = null, |
| 50 | | .decoderWithIgnore = standardBase64DecoderWithIgnore, |
| 53 | .decoderWithIgnore = standardNoPadBase64DecoderWithIgnore, |
| 51 | 54 | .Encoder = Base64Encoder.init(standard_alphabet_chars, null), |
| 52 | 55 | .Decoder = Base64Decoder.init(standard_alphabet_chars, null), |
| 53 | 56 | }; |
| ... | ... | @@ -56,6 +59,9 @@ pub const standard_no_pad = Codecs{ |
| 56 | 59 | /// [RFC 4648 section 5](https://datatracker.ietf.org/doc/html/rfc4648#section-5). |
| 57 | 60 | pub const url_safe_alphabet_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*; |
| 58 | 61 | fn urlSafeBase64DecoderWithIgnore(ignore: []const u8) Base64DecoderWithIgnore { |
| 62 | return Base64DecoderWithIgnore.init(url_safe_alphabet_chars, '=', ignore); |
| 63 | } |
| 64 | fn urlSafeNoPadBase64DecoderWithIgnore(ignore: []const u8) Base64DecoderWithIgnore { |
| 59 | 65 | return Base64DecoderWithIgnore.init(url_safe_alphabet_chars, null, ignore); |
| 60 | 66 | } |
| 61 | 67 | |
| ... | ... | @@ -74,7 +80,7 @@ pub const url_safe = Codecs{ |
| 74 | 80 | pub const url_safe_no_pad = Codecs{ |
| 75 | 81 | .alphabet_chars = url_safe_alphabet_chars, |
| 76 | 82 | .pad_char = null, |
| 77 | | .decoderWithIgnore = urlSafeBase64DecoderWithIgnore, |
| 83 | .decoderWithIgnore = urlSafeNoPadBase64DecoderWithIgnore, |
| 78 | 84 | .Encoder = Base64Encoder.init(url_safe_alphabet_chars, null), |
| 79 | 85 | .Decoder = Base64Decoder.init(url_safe_alphabet_chars, null), |
| 80 | 86 | }; |