Skip to main content
Cryptographic hash functions and checksums.
import hash

Functions

FunctionOutput FormatDescription
hash.md5(data)32-char hexMD5 hash
hash.sha1(data)40-char hexSHA-1 hash
hash.sha256(data)64-char hexSHA-256 hash
hash.sha512(data)128-char hexSHA-512 hash
hash.blake3(data)64-char hexBLAKE3 hash (very fast)
hash.xxhash(data)16-char hexXXH3 64-bit hash (extremely fast, non-crypto)
hash.xxhash128(data)32-char hexXXH3 128-bit hash

Examples

import hash

password = "secret123"
h = hash.sha256(password)
print(h)
# Output: a5d3...

data = "some large string..."
print(hash.blake3(data))

Performance

  • xxHash is the fastest, suitable for hash tables or checksums.
  • BLAKE3 is the fastest cryptographic hash.
  • SHA-256 is standard for security.

Compile Flag

cargo build --release --no-default-features --features mod_hash