THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class Argon2Hasher(IHasher): (source)
Constructor: Argon2Hasher(memory, threads, time)
Hash passwords with Argon2id.
Argon2id won the Password Hashing Competition and is the recommended default driver of the framework.
Concurrency
No locks are used. The backend class and the backend instance are cached on first use: a concurrent first use from several threads may build them twice, and the last write wins. Hashing operations only read that cache, and the fluent setters drop it so later calls rebuild the backend with the new cost parameters.
| Static Method | _validate |
Ensure a cost parameter is a strictly positive integer. |
| Method | __init__ |
Initialize the driver with its default cost parameters. |
| Method | _backend |
Return the backend class, importing it on first use. |
| Method | _build |
Build a backend instance for the given cost parameters. |
| Method | _check |
Verify a plain text value against an Argon2id hash. |
| Method | _default |
Return the cached backend built from the configured parameters. |
| Method | _identify |
Check whether the hash was produced by the Argon2 family. |
| Method | _make |
Hash a plain text value with Argon2id. |
| Async Method | check |
Verify a plain text value off the event loop. |
| Method | get |
Return the algorithm identifier of this driver. |
| Async Method | make |
Hash a plain text value off the event loop. |
| Method | needs |
Determine whether the hash uses outdated Argon2id parameters. |
| Method | set |
Set the default memory cost used by the driver. |
| Method | set |
Set the default time cost used by the driver. |
| Method | set |
Set the default parallelism used by the driver. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _backend |
Undocumented |
| Instance Variable | _backend |
Undocumented |
| Instance Variable | _memory |
Undocumented |
| Instance Variable | _threads |
Undocumented |
| Instance Variable | _time |
Undocumented |
int = DEFAULT_MEMORY, threads: int = DEFAULT_THREADS, time: int = DEFAULT_TIME):
(source)
¶
Initialize the driver with its default cost parameters.
| Parameters | |
memory:int | Memory cost in kibibytes. |
threads:int | Degree of parallelism. |
time:int | Number of iterations. |
| Returns | |
None | This method initializes the instance and returns None. |
| Raises | |
HashConfigurationException | If any cost parameter is not a positive integer. |
Return the backend class, importing it on first use.
| Returns | |
Any | Backend class provided by the underlying library. |
| Raises | |
MissingHashDependencyException | If the backend package is not installed. |
Return the cached backend built from the configured parameters.
| Returns | |
Any | Backend instance reused across calls. |
str, *, rounds: int | None = None, memory: int | None = None, threads: int | None = None) -> str:
(source)
¶
Hash a plain text value with Argon2id.
| Parameters | |
value:str | Plain text value to hash. |
rounds:int | None | Per-call time cost override. |
memory:int | None | Per-call memory cost override, in kibibytes. |
threads:int | None | Per-call parallelism override. |
| Returns | |
str | Encoded Argon2id hash. |
| Raises | |
HashConfigurationException | If any override is not a positive integer. |
str, *, rounds: int | None = None, memory: int | None = None, threads: int | None = None) -> str:
(source)
¶
orionis.hashing.contracts.IHasher.makeHash a plain text value off the event loop.
| Parameters | |
value:str | Plain text value to hash. |
rounds:int | None | Per-call time cost override. |
memory:int | None | Per-call memory cost override, in kibibytes. |
threads:int | None | Per-call parallelism override. |
| Returns | |
str | Encoded Argon2id hash. |
| Raises | |
HashConfigurationException | If any override is not a positive integer. |
Set the default memory cost used by the driver.
| Parameters | |
memory:int | New memory cost in kibibytes. |
| Returns | |
Self | The same instance, allowing fluent configuration. |
| Raises | |
HashConfigurationException | If the value is not a positive integer. |
Set the default time cost used by the driver.
| Parameters | |
rounds:int | New number of iterations. |
| Returns | |
Self | The same instance, allowing fluent configuration. |
| Raises | |
HashConfigurationException | If the value is not a positive integer. |
Set the default parallelism used by the driver.
| Parameters | |
threads:int | New degree of parallelism. |
| Returns | |
Self | The same instance, allowing fluent configuration. |
| Raises | |
HashConfigurationException | If the value is not a positive integer. |