IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

hashlib

Cryptographic and non-cryptographic hashing with customizable algorithms.

The hashlib package provides hashing functionality for computing hash values of data. It defines the core hashing infrastructure through the Hasher trait for implementing hash algorithms and the Hashable trait for types that can be hashed. The package supports both compile-time and runtime hashing with pluggable hash algorithm implementations.

Use this package for implementing hash-based data structures, creating hashable types, computing checksums, or building custom hash algorithms. Types that implement Hashable can be used as dictionary keys or in sets.

Modules

  • hash: Implements the Hashable trait and hash() built-in function.
  • hasher: Defines the Hasher trait and default hasher implementations.