parity-common/fixed-hash
David Palm 2fb834e13a Assert hash-to-uint conversions operate on same-sized types 2018-08-24 13:54:56 +02:00
..
src Assert hash-to-uint conversions operate on same-sized types 2018-08-24 13:54:56 +02:00
Cargo.toml Assert hash-to-uint conversions operate on same-sized types 2018-08-24 13:54:56 +02:00
README.md Port over relevant tests and code from parity-hash 2018-08-22 19:42:03 +02:00

README.md

Macros to construct fixed-size hash types. Does not export any types.

Examples:

construct_hash!(H256, 32);

Add conversions between differently sized hashes:

construct_hash!(H256, 32);
construct_hash!(H160, 20);
impl_hash_conversions!(H256, 32, H160, 20);

Add conversions between a hash type and the equivalently sized unsigned int:

extern crate uint;
construct_hash!(H256, 32);
use uint::U256;
impl_hash_uint_conversions!(H256, U256);

Build a serde serializable hash type:

construct_hash!(H160, 20, cfg_attr(feature = "serialize", derive(Serialize, Deserialize)));