Digestible ![Build Status] ![Latest Version]

A more dynamic Hash and Hasher trait for Rust


Key Difference over The Rust Hash and Hasher Traits

Features


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

```rust

[derive(Digestible)]

pub struct MyStruct { pub id: u32, pub name: String, #[digestible(skip)] pub password: String, } fn digesttobytes(){ let test = MyStruct{ id: 0, name: "Test".tostring(), password: "Test".tostring(), }; let mut hasher = sha2::Sha256::new(); let result = hasher.digestnative(&test); // This will be the type of sha2 Output } fn digesttobase64(){ let test = MyStruct{ id: 0, name: "Test".tostring(), password: "Test".tostring(), }; let hasher = sha2::Sha256::new().intobase64(); let result = hasher.digest_native(&test); // This is a base64 encoded string } ```