parity-common/fixed-hash
David Palm 89af0dab34 [fixed-hash] bump version: 0.2.4 2018-09-27 15:55:06 +01:00
..
src Expect a panic with the proper message 2018-09-27 09:20:15 +01:00
Cargo.toml [fixed-hash] bump version: 0.2.4 2018-09-27 15:55:06 +01: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)));