uhash-core
UniversalHash v4 algorithm - a democratic proof-of-work hash function designed for mobile-friendly mining.
Features
- Mobile-optimized: 4 parallel chains match typical phone core count
- Memory-hard: 2MB scratchpad (4x512KB) prevents GPU advantage
- ASIC-resistant: Triple primitive rotation (AES + SHA256 + BLAKE3)
- No-std compatible: Works in WASM and CosmWasm environments
- Hardware accelerated: Uses ARM/x86 intrinsics when available
Performance
| Device | Native | WASM |
|---|---|---|
| iPhone 14 Pro | 594 H/s | ~200 H/s |
| Mac M1 | 650 H/s | ~400 H/s |
| Android (8-core) | ~500 H/s | ~100 H/s |
Phone-to-desktop ratio: 1:1.09 (far exceeds target of 1:3-5)
Usage
use ;
// Create a reusable hasher (allocates 2MB scratchpad)
let mut hasher = new;
// Compute hash
let input = b"epoch_seed || miner_address || timestamp || nonce";
let hash = hasher.hash;
// Check if hash meets difficulty (number of leading zero bits)
if meets_difficulty
Algorithm Parameters
| Parameter | Value |
|---|---|
| Chains | 4 |
| Scratchpad | 512KB per chain |
| Total Memory | 2MB |
| Rounds | 12,288 |
| Block Size | 64 bytes |
Features
std(default): Enable standard library supportparallel(default): Enable parallel chain processing via rayon
For no_std environments (WASM, CosmWasm):
[]
= { = "0.1", = false }
License
Unlicense - Public Domain