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

ckb-fixed-hash

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

90 releases (24 breaking)

new 0.120.0 Dec 11, 2024
0.120.0-rc2 Nov 20, 2024
0.117.0 Jul 29, 2024
0.115.0-rc2 Mar 20, 2024
0.38.0 Nov 18, 2020

#618 in Magic Beans

Download history 823/week @ 2024-08-20 1172/week @ 2024-08-27 1152/week @ 2024-09-03 1396/week @ 2024-09-10 3075/week @ 2024-09-17 2307/week @ 2024-09-24 717/week @ 2024-10-01 2570/week @ 2024-10-08 3512/week @ 2024-10-15 3485/week @ 2024-10-22 1568/week @ 2024-10-29 515/week @ 2024-11-05 1068/week @ 2024-11-12 1130/week @ 2024-11-19 938/week @ 2024-11-26 1684/week @ 2024-12-03

4,857 downloads per month
Used in 91 crates (3 directly)

MIT license

42KB
818 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.81.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.3–2.1MB
~45K SLoC