| Crates.io | udigest |
| lib.rs | udigest |
| version | 0.2.3 |
| created_at | 2023-11-24 13:58:36.003222+00 |
| updated_at | 2025-09-24 15:00:36.206136+00 |
| description | Unambiguously digest structured data |
| homepage | |
| repository | https://github.com/LFDT-Lockness/udigest |
| max_upload_size | |
| id | 1047022 |
| size | 85,237 |
udigest provides utilities for unambiguous hashing the structured data. Structured
data can be anything that implements Digestable trait:
str, String, CStr, CStringi8, i16, i32, i64, i128,
u8, u16, u32, u64, u128,
char, isize, usizeBox, Arc, Rc, Cow, Option, ResultVec, LinkedList, VecDeque, BTreeSet, BTreeMapThe trait is intentionally not implemented for certain types:
HashMap, HashSet as they can not be traversed in deterministic orderThe Digestable trait can be implemented for the struct using a macro:
#[derive(udigest::Digestable)]
struct Person {
name: String,
job_title: String,
}
let alice = Person {
name: "Alice".into(),
job_title: "cryptographer".into(),
};
let hash = udigest::hash::<sha2::Sha256>(&alice);
The crate intentionally does not try to follow any existing standards for unambiguous
encoding. The format for encoding was designed specifically for udigest to provide
a better usage experience in Rust. The details of encoding format can be found in
encoding module.
digest enables support of hash functions that implement digest traits Digestable trait that
generically implements unambiguous encodinginline-struct is required to use inline_struct! macrostd implements Digestable trait for types in standard libraryalloc implements Digestable trait for type in alloc cratederive enables Digestable proc macroFeel free to reach out to us in Discord!