Skip to content

Commit

Permalink
Add BASE32_NOPAD_INSENSITIVE and BASE32_NOPAD_PERMISSIVE
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 committed Jan 28, 2025
1 parent a22931a commit 92719ea
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 8 deletions.
6 changes: 6 additions & 0 deletions bin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.3.6-git

### Patch

- Update `data-encoding` version

## 0.3.5

### Minor
Expand Down
4 changes: 2 additions & 2 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "data-encoding-bin"
version = "0.3.5"
version = "0.3.6-git"
authors = ["Julien Cretin <git@ia0.eu>"]
license = "MIT"
edition = "2021"
Expand All @@ -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"
6 changes: 6 additions & 0 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.8.0-git

### Minor

- Add `BASE32_NOPAD_INSENSITIVE` and `BASE32_NOPAD_PERMISSIVE`

## 2.7.0

### Minor
Expand Down
2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "data-encoding"
version = "2.7.0"
version = "2.8.0-git"
authors = ["Julien Cretin <git@ia0.eu>"]
license = "MIT"
edition = "2018"
Expand Down
6 changes: 3 additions & 3 deletions lib/macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "data-encoding-macro"
version = "0.1.16"
version = "0.1.17-git"
authors = ["Julien Cretin <cretin@google.com>"]
license = "MIT"
edition = "2018"
Expand All @@ -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" }
4 changes: 2 additions & 2 deletions lib/macro/internal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "data-encoding-macro-internal"
version = "0.1.14"
version = "0.1.15-git"
authors = ["Julien Cretin <cretin@google.com>"]
license = "MIT"
edition = "2018"
Expand All @@ -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"]
Expand Down
81 changes: 81 additions & 0 deletions lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2154,6 +2154,87 @@ 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_INSENSITIVE};
/// 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_INSENSITIVE, spec.encoding().unwrap());
/// ```
pub const BASE32_NOPAD_INSENSITIVE: Encoding =
Encoding::internal_new(BASE32_NOPAD_INSENSITIVE_IMPL);
const BASE32_NOPAD_INSENSITIVE_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_PERMISSIVE};
/// 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_PERMISSIVE, spec.encoding().unwrap());
/// ```
pub const BASE32_NOPAD_PERMISSIVE: Encoding = Encoding::internal_new(BASE32_NOPAD_PERMISSIVE_IMPL);
const BASE32_NOPAD_PERMISSIVE_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:
Expand Down

0 comments on commit 92719ea

Please sign in to comment.