Skip to main content

Crate uhash_core

Crate uhash_core 

Source
Expand description

§uhash-core

Canonical M1 mining API in this crate is Lithium v1:

UniversalHash(SHA256(miner_address_utf8 || block_hash_32 || cyberlinks_merkle_32) || nonce_le_u64)

Use:

Legacy UniversalHash v4 implementation is still present for compatibility tooling (UniversalHash, hash, v4 params), but it is non-canonical for lithium-v1 flow.

§no_std Support

This crate supports no_std environments with the alloc crate:

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

Structs§

LithiumCanonicalVector
Canonical lithium-v1 vector tuple shared across crates/tests.

Constants§

LITHIUM_BLOCK_HASH_LEN
Fixed block hash length for lithium v1 preimage.
LITHIUM_CANONICAL_VECTORS
Shared canonical vectors used by core/web/consumer parity tests.
LITHIUM_CYBERLINKS_MERKLE_LEN
Fixed cyberlinks merkle length for lithium v1 preimage.

Functions§

lithium_hash
Compute lithium v1 PoW hash using UniversalHash engine: UniversalHash(SHA256(miner_address || block_hash || cyberlinks_merkle) || nonce_le).
lithium_header
Build canonical lithium header bytes: SHA256(miner_address_utf8 || block_hash_32 || cyberlinks_merkle_32).
lithium_preimage
Build canonical lithium PoW input bytes: lithium_header || nonce_le_u64.
meets_difficulty
Check if a hash meets the required difficulty