changeset 11: |
d8f806f1d327 |
author: |
ellis <ellis@rwest.io> |
date: |
Sun, 14 May 2023 21:27:04 -0400 |
permissions: |
-rw-r--r-- |
description: |
obj updates |
1 //! hash - wrapper for hash algorithms and types 3 pub use blake3::{derive_key, hash, keyed_hash, Hash as B3Hash, Hasher as B3Hasher, OutputReader}; 7 pub use std::hash::{Hash, Hasher}; 9 pub const KEY_LEN: usize = 32; 10 pub const OUT_LEN: usize = 32; 11 pub const OUT_LEN_HEX: usize = OUT_LEN * 2; 19 let id = id::Id(vec![0; KEY_LEN]); 20 let hash = id.state_hash(&mut B3Hasher::new()); 21 assert_eq!(hash, id.state_hash(&mut B3Hasher::new())); 26 let id = id::Id(vec![255; KEY_LEN]); 29 hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap(), 36 let id = id::Id::rand(); 37 let hash = id.state_hash(&mut B3Hasher::new()); 38 assert_eq!(hash, id.state_hash(&mut B3Hasher::new())); 42 fn random_demon_id_is_valid() { 45 let did = PeerId::rand(); 46 let did2 = PeerId::rand(); 48 assert_ne!(did, did2);