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

class BcryptHasher(IHasher): (source)

Constructor: BcryptHasher(rounds)

View In Hierarchy

Hash passwords with bcrypt.

Kept for interoperability with existing applications that already store bcrypt hashes.

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 setter drops it so later calls rebuild the backend with the new cost factor.

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__ Undocumented
Instance Variable _backend Undocumented
Instance Variable _backend_class Undocumented
Instance Variable _rounds Undocumented
def _validate(rounds: int) -> int: (source)

Ensure the cost factor is supported by bcrypt.

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

Initialize the driver with its default cost factor.

Parameters
rounds:intCost factor, expressed as the base-2 logarithm of the iteration count.
Returns
NoneThis method initializes the instance and returns None.
Raises
HashConfigurationExceptionIf rounds falls outside the range supported by bcrypt.
def _backendClass(self) -> Any: (source)

Return the backend class, importing it on first use.

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

Build a backend instance for the given cost factor.

Parameters
rounds:intCost factor applied by the backend.
Returns
AnyConfigured backend instance.
def _check(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) -> Any: (source)

Return the cached backend built from the configured cost factor.

Returns
AnyBackend instance reused across calls.
def _identify(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, 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
HashConfigurationExceptionIf rounds falls outside the range supported by bcrypt.
async def check(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) -> str: (source)

Return the algorithm identifier of this driver.

Returns
strAlways 'bcrypt'.
async def make(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
HashConfigurationExceptionIf rounds falls outside the range supported by bcrypt.
def needsRehash(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, rounds: int) -> Self: (source)

Set the default cost factor used by the driver.

Parameters
rounds:intNew cost factor.
Returns
SelfThe same instance, allowing fluent configuration.
Raises
HashConfigurationExceptionIf the value falls outside the range supported by bcrypt.
_backend: Any = (source)

Undocumented

_backend_class: Any = (source)

Undocumented

Undocumented