View Source bcrypt_nif_worker (bcrypt v1.2.2)

Implementation of gen_server behaviour.

Link to this section Summary

Functions

Returns bcrypt salt.
Returns bcrypt salt.
Make hash string based on Password and Salt.
Is at least one bcrypt worker currently available for work?
Creates a gen_server process as part of a supervision tree.

Link to this section Types

-type state() :: #state{default_log_rounds :: integer(), context :: term()}.

Link to this section Functions

-spec gen_salt() -> Result when Result :: [byte()].
Returns bcrypt salt.
-spec gen_salt(Rounds) -> Result when Rounds :: bcrypt:rounds(), Result :: [byte()].
Returns bcrypt salt.
-spec hashpw(Password, Salt) -> Result
          when
              Password :: [byte()] | binary(),
              Salt :: [byte()] | binary(),
              Result :: {ok, Hash} | {error, ErrorDescription},
              Hash :: [byte()],
              ErrorDescription :: bcrypt:pwerr().
Make hash string based on Password and Salt.
-spec is_worker_available() -> Result when Result :: boolean().
Is at least one bcrypt worker currently available for work?
-spec start_link(Args) -> Result
              when
                  Args :: term(),
                  Result :: {ok, Pid} | ignore | {error, Error},
                  Pid :: pid(),
                  Error :: {already_started, Pid} | term().
Creates a gen_server process as part of a supervision tree.