whitepaper: https://pawit.co/whitepapers/fract
Run cargo add fract to have latest version added
OR
Manually add this to your Cargo.toml:
[dependencies]
fract = "0.1.0"use fract::{Fract, hash_to_hex};
// Single-shot hashing (256-bit output)
let hash = Fract::hash(b"hello cat");
println!("Hash: {:02x?}", hash);
// Or use the convenience function
let hex_hash = hash_to_hex(b"hello cat");
println!("Hex: {}", hex_hash);
// 512-bit output for enhanced quantum resistance
let hash512 = Fract::hash512(b"hello cat");
println!("512-bit: {:02x?}", hash512);use fract::Fract;
let mut hasher = Fract::new();
// Update with multiple chunks
hasher.update(b"chunk1");
hasher.update(b"chunk2");
hasher.update(b"chunk3");
// Finalize and get the hash
let hash = hasher.finalize();
println!("Hash: {:02x?}", hash);The main hasher struct that implements the sponge construction.
new() -> Self- Creates a new hasher instanceupdate(&mut self, data: &[u8])- Absorbs data into the statefinalize(self) -> [u8; 32]- Finalizes and returns 256-bit hashhash(data: &[u8]) -> [u8; 32]- One-shot hashing (256-bit)hash512(data: &[u8]) -> [u8; 64]- One-shot hashing (512-bit)
hash_to_hex(data: &[u8]) -> String- Returns 256-bit hash as hex stringhash512_to_hex(data: &[u8]) -> String- Returns 512-bit hash as hex string