#fixed-sized #nervos-ckb #constructor #static #hash #blockchain

ckb-fixed-hash

Provide several simple fixed-sized hash data type and their static constructors

110 releases (3 stable)

Uses new Rust 2024

1.0.2 Dec 18, 2025
1.0.0 Oct 29, 2025
0.203.0 Oct 22, 2025
0.202.0 Jun 11, 2025
0.38.0 Nov 18, 2020

#4 in #fixed-sized

Download history 2228/week @ 2025-10-21 1613/week @ 2025-10-28 2458/week @ 2025-11-04 2201/week @ 2025-11-11 2359/week @ 2025-11-18 4562/week @ 2025-11-25 4495/week @ 2025-12-02 4639/week @ 2025-12-09 5746/week @ 2025-12-16 5786/week @ 2025-12-23 4157/week @ 2025-12-30 6779/week @ 2026-01-06 5594/week @ 2026-01-13 9325/week @ 2026-01-20 6158/week @ 2026-01-27 10977/week @ 2026-02-03

33,575 downloads per month
Used in 96 crates (4 directly)

MIT license

42KB
817 lines

Provide several simple fixed-sized hash data type and their static constructors.

Example

use ckb_fixed_hash::{H256, h256};

const N1: H256 = h256!("0xffffffff_ffffffff_ffffffff_fffffffe_baaedce6_af48a03b_bfd25e8c_d0364141");
const N2: H256 = H256([
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36,
    0x41, 0x41
]);
assert_eq!(N1, N2);

const ONE1: H256 = h256!("0x1");
const ONE2: H256 = H256([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
assert_eq!(ONE1, ONE2);

ckb-fixed-hash

This crate is a component of ckb.

Provide several simple fixed-sized hash data type and their static constructors.

Dependencies

~0.7–1.7MB
~35K SLoC