Skip to main content

Crate uhash_core

Crate uhash_core 

Source
Expand description

§uhash-core

UniversalHash v4 — democratic proof-of-work hash engine.

§Primary API

§no_std Support

This crate supports no_std environments with the alloc crate:

[dependencies]
uhash-core = { version = "0.3", default-features = false }

Structs§

UniversalHash
UniversalHash v4 hasher

Constants§

AES_BLOCK_SIZE
AES block size
BLAKE3_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.