diff --git a/bin/CHANGELOG.md b/bin/CHANGELOG.md index 64ef992..9e0b2df 100644 --- a/bin/CHANGELOG.md +++ b/bin/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.3.6-git + +### Patch + +- Update `data-encoding` version + ## 0.3.5 ### Minor diff --git a/bin/Cargo.toml b/bin/Cargo.toml index 03de942..4cf6c79 100644 --- a/bin/Cargo.toml +++ b/bin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "data-encoding-bin" -version = "0.3.5" +version = "0.3.6-git" authors = ["Julien Cretin "] license = "MIT" edition = "2021" @@ -17,5 +17,5 @@ name = "data-encoding" path = "src/main.rs" [dependencies] -data-encoding = { version = "2.7.0", path = "../lib" } +data-encoding = { version = "2.8.0-git", path = "../lib" } getopts = "0.2" diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index 89732c9..1b30205 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2.8.0-git + +### Minor + +- Add `BASE32_NOPAD_NOCASE` and `BASE32_NOPAD_VISUAL` + ## 2.7.0 ### Minor diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 2c587a5..0371e35 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "data-encoding" -version = "2.7.0" +version = "2.8.0-git" authors = ["Julien Cretin "] license = "MIT" edition = "2018" diff --git a/lib/README.md b/lib/README.md index f2d892e..583cf62 100644 --- a/lib/README.md +++ b/lib/README.md @@ -3,24 +3,26 @@ This library provides the following common encodings: -| Name | Description | -|--------------------------|---------------------------------------------------| -| `HEXLOWER` | lowercase hexadecimal | -| `HEXLOWER_PERMISSIVE` | lowercase hexadecimal (case-insensitive decoding) | -| `HEXUPPER` | uppercase hexadecimal | -| `HEXUPPER_PERMISSIVE` | uppercase hexadecimal (case-insensitive decoding) | -| `BASE32` | RFC4648 base32 | -| `BASE32_NOPAD` | RFC4648 base32 (no padding) | -| `BASE32_DNSSEC` | RFC5155 base32 | -| `BASE32_DNSCURVE` | DNSCurve base32 | -| `BASE32HEX` | RFC4648 base32hex | -| `BASE32HEX_NOPAD` | RFC4648 base32hex (no padding) | -| `BASE64` | RFC4648 base64 | -| `BASE64_NOPAD` | RFC4648 base64 (no padding) | -| `BASE64_MIME` | RFC2045-like base64 | -| `BASE64_MIME_PERMISSIVE` | RFC2045-like base64 (ignoring trailing bits) | -| `BASE64URL` | RFC4648 base64url | -| `BASE64URL_NOPAD` | RFC4648 base64url (no padding) | +| Name | Description | +|--------------------------|--------------------------------------------------------| +| `HEXLOWER` | lowercase hexadecimal | +| `HEXLOWER_PERMISSIVE` | lowercase hexadecimal (case-insensitive decoding) | +| `HEXUPPER` | uppercase hexadecimal | +| `HEXUPPER_PERMISSIVE` | uppercase hexadecimal (case-insensitive decoding) | +| `BASE32` | RFC4648 base32 | +| `BASE32_NOPAD` | RFC4648 base32 (no padding) | +| `BASE32_NOPAD_NOCASE` | RFC4648 base32 (no padding, case-insensitive decoding) | +| `BASE32_NOPAD_VISUAL` | RFC4648 base32 (no padding, visual-approx. decoding) | +| `BASE32HEX` | RFC4648 base32hex | +| `BASE32HEX_NOPAD` | RFC4648 base32hex (no padding) | +| `BASE32_DNSSEC` | RFC5155 base32 | +| `BASE32_DNSCURVE` | DNSCurve base32 | +| `BASE64` | RFC4648 base64 | +| `BASE64_NOPAD` | RFC4648 base64 (no padding) | +| `BASE64_MIME` | RFC2045-like base64 | +| `BASE64_MIME_PERMISSIVE` | RFC2045-like base64 (ignoring trailing bits) | +| `BASE64URL` | RFC4648 base64url | +| `BASE64URL_NOPAD` | RFC4648 base64url (no padding) | It also provides the possibility to define custom little-endian ASCII base-conversion encodings for bases of size 2, 4, 8, 16, 32, and 64 (for which diff --git a/lib/macro/Cargo.toml b/lib/macro/Cargo.toml index 076e477..bc9148e 100644 --- a/lib/macro/Cargo.toml +++ b/lib/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "data-encoding-macro" -version = "0.1.16" +version = "0.1.17-git" authors = ["Julien Cretin "] license = "MIT" edition = "2018" @@ -14,5 +14,5 @@ description = "Macros for data-encoding" include = ["Cargo.toml", "LICENSE", "README.md", "src/lib.rs"] [dependencies] -data-encoding = { version = "2.7.0", path = "..", default-features = false } -data-encoding-macro-internal = { version = "0.1.14", path = "internal" } +data-encoding = { version = "2.8.0-git", path = "..", default-features = false } +data-encoding-macro-internal = { version = "0.1.15-git", path = "internal" } diff --git a/lib/macro/internal/Cargo.toml b/lib/macro/internal/Cargo.toml index ca07b1c..9b0281f 100644 --- a/lib/macro/internal/Cargo.toml +++ b/lib/macro/internal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "data-encoding-macro-internal" -version = "0.1.14" +version = "0.1.15-git" authors = ["Julien Cretin "] license = "MIT" edition = "2018" @@ -14,7 +14,7 @@ include = ["Cargo.toml", "LICENSE", "README.md", "src/lib.rs"] proc-macro = true [dependencies.data-encoding] -version = "2.7.0" +version = "2.8.0-git" path = "../.." default-features = false features = ["alloc"] diff --git a/lib/src/lib.rs b/lib/src/lib.rs index e169c10..3ec85ed 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -2154,6 +2154,86 @@ const BASE32_NOPAD_IMPL: &[u8] = &[ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29, ]; +/// Unpadded base32 encoding with case-insensitive decoding +/// +/// This encoding is a static version of: +/// +/// ```rust +/// # use data_encoding::{Specification, BASE32_NOPAD_NOCASE}; +/// let mut spec = Specification::new(); +/// spec.symbols.push_str("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"); +/// spec.translate.from.push_str("abcdefghijklmnopqrstuvwxyz"); +/// spec.translate.to.push_str("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); +/// assert_eq!(BASE32_NOPAD_NOCASE, spec.encoding().unwrap()); +/// ``` +pub const BASE32_NOPAD_NOCASE: Encoding = Encoding::internal_new(BASE32_NOPAD_NOCASE_IMPL); +const BASE32_NOPAD_NOCASE_IMPL: &[u8] = &[ + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 128, 128, 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 29, +]; + +/// Unpadded base32 encoding with visual error correction during decoding +/// +/// This encoding is a static version of: +/// +/// ```rust +/// # use data_encoding::{Specification, BASE32_NOPAD_VISUAL}; +/// let mut spec = Specification::new(); +/// spec.symbols.push_str("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"); +/// spec.translate.from.push_str("01l8"); +/// spec.translate.to.push_str("OIIB"); +/// assert_eq!(BASE32_NOPAD_VISUAL, spec.encoding().unwrap()); +/// ``` +pub const BASE32_NOPAD_VISUAL: Encoding = Encoding::internal_new(BASE32_NOPAD_VISUAL_IMPL); +const BASE32_NOPAD_VISUAL_IMPL: &[u8] = &[ + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 14, 8, 26, 27, 28, 29, 30, 31, 1, 128, 128, 128, 128, 128, 128, 128, 128, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 8, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29, +]; + /// Padded base32hex encoding /// /// This encoding is a static version of: