Skip to main content

uhash_core/
lib.rs

1//! # uhash-core
2//!
3//! Canonical M1 mining API in this crate is Lithium v1:
4//!
5//! `UniversalHash(SHA256(miner_address_utf8 || block_hash_32 || cyberlinks_merkle_32) || nonce_le_u64)`
6//!
7//! Use:
8//!
9//! - [`lithium_header`]
10//! - [`lithium_preimage`]
11//! - [`lithium_hash`]
12//! - [`meets_difficulty`]
13//!
14//! Legacy UniversalHash v4 implementation is still present for compatibility tooling
15//! (`UniversalHash`, `hash`, v4 params), but it is non-canonical for lithium-v1 flow.
16//!
17//! ## no_std Support
18//!
19//! This crate supports `no_std` environments with the `alloc` crate:
20//!
21//! ```toml
22//! [dependencies]
23//! uhash-core = { version = "0.2", default-features = false }
24//! ```
25
26#![cfg_attr(not(feature = "std"), no_std)]
27
28#[cfg(not(feature = "std"))]
29extern crate alloc;
30
31mod lithium;
32mod params;
33mod primitives;
34mod uhash;
35
36#[cfg(feature = "std")]
37mod ffi;
38
39pub use lithium::{
40    lithium_hash, lithium_header, lithium_preimage, LithiumCanonicalVector, LITHIUM_BLOCK_HASH_LEN,
41    LITHIUM_CANONICAL_VECTORS, LITHIUM_CYBERLINKS_MERKLE_LEN,
42};
43pub use uhash::meets_difficulty;
44
45// Legacy UniversalHash v4 API remains available for compatibility tooling,
46// but is intentionally hidden from generated docs as non-canonical.
47#[doc(hidden)]
48pub use params::*;
49#[doc(hidden)]
50pub use uhash::{hash, UniversalHash};
51
52#[cfg(test)]
53mod tests;