Digestible

A more dynamic Hash and Hasher trait for Rust
Key Difference over The Rust Hash and Hasher Traits
- ByteOrder is built in. So you can digest number types in any byte order. ByteOrder
- Output is a Generic Associated Type. So you can Digest into a ByteArray, String with Base64 or any type the Digester uses.
- Skip Fields with
#[digestible(skip)] - 'digest_with' and 'with' to override the default digest behavior. digest_with
- Support for all Hashing Algorithms that implement digest::Digest such as SHA2, md-5, and many more.
- Writing Type Headers to prevent collisions with similar types. (This is optional and can be disabled with
#[digestible(type_header = none)])
Features
no_stdSupport- Digest to implement Digester for all types that implement digest::Digest
- Float and Atomic Support using
digest_with
Working with Hash
For types that do not Implement Digestible
you can add #[digestible(digest_with = digest_with_hash)] to your variable
to tell Digestible to use Hash to digest it.
Implementing Hash with Digestible.
Adding #[digestible(hash)] to your struct or enum will implement Hash for it.
Using the digest function.
Allowing you to have a Hash and Digestible that are the same.
Example Using SHA2