Reference · reference
hash module
use hash computes cryptographic digests of strings and files. Every function returns the digest as a lowercase hexadecimal string. The string variants cannot fail. The file variants return Result[string, string] and fail when the file cannot be opened or read. MD5 is provided for interoperability with legacy checksums only.
sha256 and sha256_file
rust
sha256 sha256_file
SHA-256 of a string, or of a file's contents.
sha512 and sha512_file
rust
sha512 sha512_file
SHA-512 of a string, or of a file's contents.
md5 and md5_file
rust
md5 md5_file
MD5 of a string, or of a file's contents. Use it only to compare against a checksum that was published as MD5.
rust
use hash
let digest = sha256_file?
if digest != expected