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.
HashForgeConfig is a dataclass that centralises algorithm tuning parameters — iteration counts, memory costs, round factors — in a single, serialisable object. Rather than scattering **kwargs across multiple from_algorithms calls, you load a config once (from environment variables, a JSON file, or a plain dict) and hand it to HashManager.from_config. This keeps production tuning outside your source code and makes parameter management reproducible across deployments.
Class Methods (Loaders)
from_env
prefix. Unset variables fall back to the library defaults.
Prefix applied to all environment variable names. Defaults to
"HASH_FORGE_".HashForgeConfig
Environment variable mapping:
| Field | Environment Variable |
|---|---|
pbkdf2_iterations | HASH_FORGE_PBKDF2_ITERATIONS |
pbkdf2_salt_length | HASH_FORGE_PBKDF2_SALT_LENGTH |
bcrypt_rounds | HASH_FORGE_BCRYPT_ROUNDS |
argon2_time_cost | HASH_FORGE_ARGON2_TIME_COST |
argon2_memory_cost | HASH_FORGE_ARGON2_MEMORY_COST |
argon2_parallelism | HASH_FORGE_ARGON2_PARALLELISM |
argon2_hash_len | HASH_FORGE_ARGON2_HASH_LEN |
scrypt_n | HASH_FORGE_SCRYPT_N |
scrypt_r | HASH_FORGE_SCRYPT_R |
scrypt_p | HASH_FORGE_SCRYPT_P |
from_json
HashForgeConfig field names exactly.
Path to the JSON configuration file.
HashForgeConfig
from_dict
HashForgeConfig directly from a Python dictionary. Useful for programmatic configuration in tests, factories, or application bootstrapping.
A dictionary whose keys correspond to
HashForgeConfig field names.HashForgeConfig
Instance Methods (Exporters)
to_dict
from_dict elsewhere.
Returns: dict[str, Any]
to_json
Destination path for the JSON file.
get_hasher_config
HashManager.from_config calls internally for each algorithm.
The algorithm name to look up, e.g.
"pbkdf2_sha256", "argon2", "bcrypt", "scrypt".dict[str, Any] — algorithm-specific kwargs ready to pass to a hasher constructor. Returns {} for algorithms not explicitly supported (e.g. blake2, sha3_256).
| Algorithm | Returned keys |
|---|---|
pbkdf2_sha256 / pbkdf2_sha1 | iterations, salt_length |
bcrypt / bcrypt_sha256 | rounds |
argon2 | time_cost, memory_cost, parallelism, hash_len |
scrypt | work_factor, block_size, parallelism |
Dataclass Fields
All fields are mutable (not frozen) and carry sensible defaults matching Hash Forge’s built-in constants.| Field | Type | Default | Description |
|---|---|---|---|
pbkdf2_iterations | int | 150_000 | PBKDF2 iteration count. |
pbkdf2_salt_length | int | 16 | PBKDF2 salt length in bytes. |
bcrypt_rounds | int | 12 | bcrypt cost factor (work rounds). |
argon2_time_cost | int | 3 | Argon2 time cost (number of passes). |
argon2_memory_cost | int | 65_536 | Argon2 memory cost in KiB. |
argon2_parallelism | int | 1 | Argon2 degree of parallelism. |
argon2_hash_len | int | 32 | Argon2 output hash length in bytes. |
scrypt_n | int | 32_768 | Scrypt CPU/memory cost parameter (N). |
scrypt_r | int | 8 | Scrypt block size parameter (r). |
scrypt_p | int | 1 | Scrypt parallelization parameter (p). |
custom | dict[str, Any] | {} | Arbitrary application-specific metadata. |
Usage Example
Load configuration from environment variables and create aHashManager:
