diff --git a/Cargo.lock b/Cargo.lock index 2c716721..cf659668 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,7 +10,7 @@ version = "0.4.0" name = "block-buffer" version = "0.11.0-rc.5" dependencies = [ - "hex-literal 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 1.0.0", "hybrid-array", "zeroize 1.8.2", ] @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cmov" @@ -112,12 +112,12 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcaaec4551594c969335c98c903c1397853d4198408ea609190f420500f6be71" [[package]] name = "hex-literal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcaaec4551594c969335c98c903c1397853d4198408ea609190f420500f6be71" +version = "1.1.0" [[package]] name = "hybrid-array" @@ -153,9 +153,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.176" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "memchr" @@ -169,9 +169,9 @@ version = "0.4.0-pre" [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -257,9 +257,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.106" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", @@ -274,9 +274,9 @@ checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" [[package]] name = "wycheproof2blb" diff --git a/hex-literal/CHANGELOG.md b/hex-literal/CHANGELOG.md index 4247fe11..a5b1ea96 100644 --- a/hex-literal/CHANGELOG.md +++ b/hex-literal/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.1.0 (2025-10-29) +### Added +- Colon-delimited literals support ([#1244]) + +[#1244]: https://github.com/RustCrypto/utils/pull/1244 + ## 1.0.0 (2025-02-22) ### Changed - Edition changed to 2024 and MSRV bumped to 1.85 ([#1149]) diff --git a/hex-literal/Cargo.toml b/hex-literal/Cargo.toml index 44527917..d7f75631 100644 --- a/hex-literal/Cargo.toml +++ b/hex-literal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hex-literal" -version = "1.0.0" +version = "1.1.0" authors = ["RustCrypto Developers"] edition = "2024" rust-version = "1.85" diff --git a/hex-literal/README.md b/hex-literal/README.md index 277bf56a..8778cf00 100644 --- a/hex-literal/README.md +++ b/hex-literal/README.md @@ -11,7 +11,7 @@ This crate provides the `hex!` macro for converting a sequence of hexadecimal st The macro accepts the following characters in input string literals: - `'0'...'9'`, `'a'...'f'`, `'A'...'F'` — hex characters which will be used in construction of the output byte array -- `' '`, `'\r'`, `'\n'`, `'\t'` — formatting characters which will be ignored +- `' '`, `:`, `'\r'`, `'\n'`, `'\t'` — formatting characters which will be ignored # Examples ```rust @@ -26,6 +26,9 @@ assert_eq!(hex!("a1 b2 c3 d4"), [0xA1, 0xB2, 0xC3, 0xD4]); assert_eq!(hex!("E5 E6 90 92"), [0xE5, 0xE6, 0x90, 0x92]); assert_eq!(hex!("0a0B 0C0d"), [10, 11, 12, 13]); +// Colon-delimited literals +assert_eq!(hex!("0A:0B:0C:0D"), [10, 11, 12, 13]); + // Multi-line literals let bytes1 = hex!(" 00010203 04050607 diff --git a/hex-literal/src/lib.rs b/hex-literal/src/lib.rs index 61668c03..ca97b177 100644 --- a/hex-literal/src/lib.rs +++ b/hex-literal/src/lib.rs @@ -13,7 +13,7 @@ const fn next_hex_char(string: &[u8], mut pos: usize) -> Option<(u8, usize)> { b'0'..=b'9' => raw_val - 48, b'A'..=b'F' => raw_val - 55, b'a'..=b'f' => raw_val - 87, - b' ' | b'\r' | b'\n' | b'\t' => continue, + b' ' | b':' | b'\r' | b'\n' | b'\t' => continue, 0..=127 => panic!("Encountered invalid ASCII character"), _ => panic!("Encountered non-ASCII character"), };