Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Zozi96/hash-forge/llms.txt
Use this file to discover all available pages before exploring further.
HashManagerBuilder provides a fluent, chainable interface for constructing a HashManager instance. Instead of instantiating hashers manually, you declare the algorithms and their parameters step by step, then call build() to receive a fully configured HashManager. The builder is especially useful when you need fine-grained, per-algorithm parameter control that from_algorithms cannot express in a single call.
You can obtain a builder either by importing HashManagerBuilder directly or by calling HashManager.builder():
HashManager.builder() is a convenience alias.
Methods
with_algorithm
HasherFactory, passing any supplied keyword arguments directly to the hasher’s constructor. The hasher is appended to the internal list in the order this method is called.
The algorithm identifier to add, e.g.
"argon2", "pbkdf2_sha256". See AlgorithmType for all valid values.Algorithm-specific constructor parameters. For example,
time_cost and memory_cost for Argon2, rounds for bcrypt, or iterations for PBKDF2.HashManagerBuilder — the same builder instance for chaining.
with_hasher
PHasher protocol. Use this when you have a custom hasher implementation or need to reuse a hasher created elsewhere.
A fully initialised hasher instance. Its
algorithm attribute is used as the registration key.HashManagerBuilder — the same builder instance for chaining.
with_preferred
with_algorithm or with_hasher is used as the preferred hasher automatically.
The algorithm identifier to promote to preferred. This algorithm must have already been added to the builder.
HashManagerBuilder — the same builder instance for chaining.
build
HashManager instance. If with_preferred was called, the designated hasher is moved to the front of the internal list so it becomes the preferred hasher.
Returns: HashManager — a fully configured instance ready for use.
Raises:
| Exception | Condition |
|---|---|
ValueError | No hashers were added before calling build(). |
ValueError | The algorithm passed to with_preferred was not added to the builder. |
