uhash-core 0.1.0

UniversalHash v4 algorithm - democratic proof-of-work for Bostrom blockchain
Documentation

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 uhash_core::{UniversalHash, meets_difficulty};

// Create a reusable hasher (allocates 2MB scratchpad)
let mut hasher = UniversalHash::new();

// Compute hash
let input = b"epoch_seed || miner_address || timestamp || nonce";
let hash = hasher.hash(input);

// Check if hash meets difficulty (number of leading zero bits)
if meets_difficulty(&hash, 20) {
    println!("Found valid proof!");
}

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 support
  • parallel (default): Enable parallel chain processing via rayon

For no_std environments (WASM, CosmWasm):

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

License

Unlicense - Public Domain