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