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

ckb-fixed-hash

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

97 releases (27 breaking)

Uses new Rust 2024

new 0.201.0-rc1 Mar 24, 2025
0.200.0-rc2 Feb 26, 2025
0.120.0 Dec 11, 2024
0.120.0-rc2 Nov 20, 2024
0.38.0 Nov 18, 2020

#5 in #fixed-hash

Download history 1526/week @ 2024-12-01 2101/week @ 2024-12-08 2302/week @ 2024-12-15 1168/week @ 2024-12-22 1362/week @ 2024-12-29 1565/week @ 2025-01-05 1962/week @ 2025-01-12 1861/week @ 2025-01-19 559/week @ 2025-01-26 965/week @ 2025-02-02 865/week @ 2025-02-09 1197/week @ 2025-02-16 1927/week @ 2025-02-23 1656/week @ 2025-03-02 1736/week @ 2025-03-09 1479/week @ 2025-03-16

7,006 downloads per month
Used in 91 crates (3 directly)

MIT license

42KB
817 lines

ckb-fixed-hash

This crate is a component of ckb.

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

Minimum Supported Rust Version policy (MSRV)

This crate's minimum supported rustc version is 1.85.0


lib.rs:

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);

Dependencies

~1–1.8MB
~39K SLoC