Skip to main content

One post tagged with "sha1"

View All Tags

Rust Generate SHA1 Hash

· One min read
forfd8960
Author

the crate

[dependencies]
sha1-checked = "0.10.0"
base16ct = { version="0.2.0", features=["alloc"] }

Generate SHA1 Hash bytes

  • build sha1 hasher with Sha1::new()
  • update the hasher with hasher.update(content)
  • call hasher.try_finalize() to get the hash
  • generate hash bytes with
let arr = hf.hash();
arr.to_vec()