MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / hash

Function hash

utils/src/crypto.rs:139–141  ·  view source on GitHub ↗

Create a hash ```rust use utils::crypto::hash; let message = b"The message"; let hashed = hash(message); assert_eq!(hashed, [ 174, 253, 38, 204, 75, 207, 36, 167, 252, 109, 46, 248, 163, 40, 95, 14, 14, 198, 197, 2, 119, 153, 141, 102, 195, 214, 250, 111, 247, 123, 45, 64 ]); ```

(bytes: &[u8])

Source from the content-addressed store, hash-verified

137/// ]);
138/// ```
139pub fn hash(bytes: &[u8]) -> [u8; 32] {
140 Keccak256::digest(bytes).into()
141}
142
143/// Sign a message with a private key
144///

Callers 6

hashMethod · 0.85
signMethod · 0.85
newMethod · 0.85
to_addressFunction · 0.85
hash_messageFunction · 0.85
it_hashesFunction · 0.85

Calls

no outgoing calls

Tested by 1

it_hashesFunction · 0.68