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

ckb-fixed-hash

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

73 releases (20 breaking)

0.116.1 May 11, 2024
0.116.0-rc2 Apr 25, 2024
0.115.0-rc2 Mar 20, 2024
0.113.0-rc2 Dec 19, 2023
0.38.0 Nov 18, 2020

#2609 in Magic Beans

Download history 549/week @ 2024-02-05 585/week @ 2024-02-12 968/week @ 2024-02-19 1822/week @ 2024-02-26 754/week @ 2024-03-04 692/week @ 2024-03-11 1288/week @ 2024-03-18 937/week @ 2024-03-25 1511/week @ 2024-04-01 629/week @ 2024-04-08 504/week @ 2024-04-15 1280/week @ 2024-04-22 407/week @ 2024-04-29 1462/week @ 2024-05-06 760/week @ 2024-05-13 487/week @ 2024-05-20

3,210 downloads per month
Used in 88 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.75.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

~0.9–1.7MB
~37K SLoC