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.
Hash passwords with bcrypt.
Kept for interoperability with existing applications that already store bcrypt hashes.
Concurrency
A short lock protects parameter snapshots and cache publication. Backend construction and hashing run outside the lock. An operation already using the previous cost can finish after a setter, but cannot restore that cost in the shared cache.
| Static Method | _validate |
Ensure the cost factor is supported by bcrypt. |
| Method | __init__ |
Initialize the driver with its default cost factor. |
| Method | _backend |
Return the backend class, importing it on first use. |
| Method | _build |
Build a backend instance for the given cost factor. |
| Method | _check |
Verify a plain text value against a bcrypt hash. |
| Method | _default |
Return the cached backend built from the configured cost factor. |
| Method | _identify |
Check whether the hash was produced by bcrypt. |
| Method | _make |
Hash a plain text value with bcrypt. |
| 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 an outdated cost factor. |
| Method | set |
Set the default cost factor used by the driver. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | _backend |
Backend implementation used to perform the configured operation. |
| Instance Variable | _backend |
The backend is imported and built on first use to keep the driver constructible even when the dependency is absent. |
| Instance Variable | _executor |
Caller-owned dedicated executor, or the shared bounded hashing pool. |
| Instance Variable | _rounds |
Cost factor, expressed as the base-2 logarithm of the iteration count. |
| Instance Variable | _state |
Lock protecting cost snapshots and backend cache publication. |
Ensure the cost factor is supported by bcrypt.
| Parameters | |
rounds:int | Value to validate. |
| Returns | |
int | The validated value. |
| Raises | |
orionis.hashing.exceptions.HashConfigurationException | If the value is not an integer within the supported range. |
Self, *, rounds: int = DEFAULT_ROUNDS, executor: BoundedExecutor | None = None):
(source)
¶
Initialize the driver with its default cost factor.
| Parameters | |
rounds:int | Cost factor, expressed as the base-2 logarithm of the iteration count. |
executor:orionis.support.concurrency.BoundedExecutor | None | Caller-owned dedicated executor, or the shared bounded hashing pool. |
| Returns | |
None | No return value. |
| Raises | |
orionis.hashing.exceptions.HashConfigurationException | If rounds falls outside the range supported by bcrypt. |
Return the backend class, importing it on first use.
| Returns | |
typing.Any | Backend class provided by the underlying library. |
| Raises | |
orionis.hashing.exceptions.MissingHashDependencyException | If the backend package is not installed. |
Build a backend instance for the given cost factor.
| Parameters | |
rounds:int | Cost factor applied by the backend. |
| Returns | |
typing.Any | Configured backend instance. |
Return the cached backend built from the configured cost factor.
| Returns | |
typing.Any | Backend instance reused across calls. |
Self, value: str, *, rounds: int | None = None, memory: int | None = None, threads: int | None = None) -> str:
(source)
¶
Hash a plain text value with bcrypt.
| Parameters | |
value:str | Plain text value to hash. |
rounds:int | None | Per-call cost factor override. |
memory:int | None | Ignored, bcrypt has no memory cost parameter. |
threads:int | None | Ignored, bcrypt has no parallelism parameter. |
| Returns | |
str | Encoded bcrypt hash. |
| Raises | |
orionis.hashing.exceptions.HashConfigurationException | If rounds falls outside the range supported by bcrypt. |
Self, value: 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 cost factor override. |
memory:int | None | Ignored, bcrypt has no memory cost parameter. |
threads:int | None | Ignored, bcrypt has no parallelism parameter. |
| Returns | |
str | Encoded bcrypt hash. |
| Raises | |
orionis.hashing.exceptions.HashConfigurationException | If rounds falls outside the range supported by bcrypt. |
Set the default cost factor used by the driver.
| Parameters | |
rounds:int | New cost factor. |
| Returns | |
typing.Self | The same instance, allowing fluent configuration. |
| Raises | |
orionis.hashing.exceptions.HashConfigurationException | If the value falls outside the range supported by bcrypt. |