aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlexx Roche <[email protected]>2020-08-14 12:00:13 +0200
committerJack O'Connor <[email protected]>2020-08-14 11:22:56 -0400
commit7589c8c608850f8780a3572f23ef1f016a7148f6 (patch)
treebb878f6fa3e913a7f987bf17c0658580ed1b904b /README.md
parent63d27d4d1ee18b808f5d879c5839b21266a491d3 (diff)
How to access the hex inside the Hash()
blake3::hash(b"str") -> Hash(hex) and I want the `hex` stripped out from the Hash() as a str
Diffstat (limited to 'README.md')
-rw-r--r--README.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/README.md b/README.md
index c9f8bd5..3ab72f1 100644
--- a/README.md
+++ b/README.md
@@ -130,6 +130,11 @@ let mut output = [0; 1000];
let mut output_reader = hasher.finalize_xof();
output_reader.fill(&mut output);
assert_eq!(&output[..32], hash1.as_bytes());
+
+// Extract hash as hex str
+let hash1_hex = &hash1.to_hex()[..];
+assert_eq!("c09afee0c9f361fb61e5ff28a7739893de766fb470c5fa82b4e5e31de27fbad4", hash1_hex);
+
```
Besides `hash`, BLAKE3 provides two other modes, `keyed_hash` and