ORIONIS API REFERENCE

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 documentation

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 _backendClass 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 getAlgorithm Return the algorithm identifier of this driver.
Async Method make Hash a plain text value off the event loop.
Method needsRehash Determine whether the hash uses an outdated cost factor.
Method setRounds 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_class 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 Lock protecting cost snapshots and backend cache publication.
def _validate(rounds: int) -> int: (source)

Ensure the cost factor is supported by bcrypt.

Parameters
rounds:intValue to validate.
Returns
intThe validated value.
Raises
orionis.hashing.exceptions.HashConfigurationExceptionIf the value is not an integer within the supported range.
def __init__(self: Self, *, rounds: int = DEFAULT_ROUNDS, executor: BoundedExecutor | None = None): (source)

Initialize the driver with its default cost factor.

Parameters
rounds:intCost factor, expressed as the base-2 logarithm of the iteration count.
executor:orionis.support.concurrency.BoundedExecutor | NoneCaller-owned dedicated executor, or the shared bounded hashing pool.
Returns
NoneNo return value.
Raises
orionis.hashing.exceptions.HashConfigurationExceptionIf rounds falls outside the range supported by bcrypt.
def _backendClass(self: Self) -> Any: (source)

Return the backend class, importing it on first use.

Returns
typing.AnyBackend class provided by the underlying library.
Raises
orionis.hashing.exceptions.MissingHashDependencyExceptionIf the backend package is not installed.
def _build(self: Self, rounds: int) -> Any: (source)

Build a backend instance for the given cost factor.

Parameters
rounds:intCost factor applied by the backend.
Returns
typing.AnyConfigured backend instance.
def _check(self: Self, value: str, hashed: str) -> bool: (source)

Verify a plain text value against a bcrypt hash.

Parameters
value:strPlain text value to verify.
hashed:strPreviously generated hash.
Returns
boolTrue when the value matches the hash, False otherwise.
def _default(self: Self) -> Any: (source)

Return the cached backend built from the configured cost factor.

Returns
typing.AnyBackend instance reused across calls.
def _identify(self: Self, hashed: str) -> bool: (source)

Check whether the hash was produced by bcrypt.

Parameters
hashed:strHash to inspect.
Returns
boolTrue when the hash belongs to this driver.
def _make(self: 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:strPlain text value to hash.
rounds:int | NonePer-call cost factor override.
memory:int | NoneIgnored, bcrypt has no memory cost parameter.
threads:int | NoneIgnored, bcrypt has no parallelism parameter.
Returns
strEncoded bcrypt hash.
Raises
orionis.hashing.exceptions.HashConfigurationExceptionIf rounds falls outside the range supported by bcrypt.
async def check(self: Self, value: str, hashed: str) -> bool: (source)

Verify a plain text value off the event loop.

Parameters
value:strPlain text value to verify.
hashed:strPreviously generated hash.
Returns
boolTrue when the value matches the hash, False otherwise.
def getAlgorithm(self: Self) -> str: (source)

Return the algorithm identifier of this driver.

Returns
strAlways 'bcrypt'.
async def make(self: Self, value: str, *, rounds: int | None = None, memory: int | None = None, threads: int | None = None) -> str: (source)

Hash a plain text value off the event loop.

Parameters
value:strPlain text value to hash.
rounds:int | NonePer-call cost factor override.
memory:int | NoneIgnored, bcrypt has no memory cost parameter.
threads:int | NoneIgnored, bcrypt has no parallelism parameter.
Returns
strEncoded bcrypt hash.
Raises
orionis.hashing.exceptions.HashConfigurationExceptionIf rounds falls outside the range supported by bcrypt.
def needsRehash(self: Self, hashed: str) -> bool: (source)

Determine whether the hash uses an outdated cost factor.

Parameters
hashed:strPreviously generated hash.
Returns
boolTrue when the hash should be regenerated.
def setRounds(self: Self, rounds: int) -> Self: (source)

Set the default cost factor used by the driver.

Parameters
rounds:intNew cost factor.
Returns
typing.SelfThe same instance, allowing fluent configuration.
Raises
orionis.hashing.exceptions.HashConfigurationExceptionIf the value falls outside the range supported by bcrypt.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

_backend: Any = (source)

Backend implementation used to perform the configured operation.

_backend_class: Any = (source)

The backend is imported and built on first use to keep the driver constructible even when the dependency is absent.

_executor = (source)

Caller-owned dedicated executor, or the shared bounded hashing pool.

Cost factor, expressed as the base-2 logarithm of the iteration count.

_state_lock = (source)

Lock protecting cost snapshots and backend cache publication.