Expand description
§uhash-core
UniversalHash v4 — democratic proof-of-work hash engine.
§Primary API
hash— one-shot hash functionUniversalHash— reusable hasher (avoids re-allocation)meets_difficulty/verify— proof verificationbuild_input/challenge_input— challenge utilities
§no_std Support
This crate supports no_std environments with the alloc crate:
[dependencies]
uhash-core = { version = "0.3", default-features = false }Structs§
- Universal
Hash - UniversalHash v4 hasher
Constants§
- AES_
BLOCK_ SIZE - AES block size
- BLAK
E3_ SIZE - BLAKE3 output size
- BLOCKS_
PER_ SCRATCHPAD - Number of blocks per scratchpad
- BLOCK_
SIZE - Block size in bytes for memory operations
- CHAINS
- Number of parallel computation chains
- ROUNDS
- Number of rounds per chain (spec: 12,288)
- SCRATCHPAD_
SIZE - Scratchpad size per chain in bytes (512 KB)
- SHA256_
SIZE - SHA-256 output size
- TOTAL_
MEMORY - Total memory footprint (2 MB)
- VERSION
- Algorithm version
Functions§
- build_
input - Build PoW input bytes from a challenge header and nonce.
- challenge_
input - Build PoW input from a typed Challenge and nonce.
- encode_
difficulty - Encode a difficulty as leading zero bit count.
- hash
- Convenience function for single-shot hashing
- meets_
difficulty - Check if a hash meets the required difficulty (leading zero bits).
- verify
- Verify a proof: recompute hash and check difficulty.