Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions hex-literal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion hex-literal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 4 additions & 1 deletion hex-literal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hex-literal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
};
Expand Down