View Source bcrypt_pool (bcrypt v1.2.1)

Implementation of gen_server behaviour.

Link to this section Summary

Functions

Asynchronosly check if Pid in #state:requests queue or not.
Generate a random text salt.
Generate a random text salt. Rounds defines the complexity of the hashing, increasing the cost as 2^log_rounds.
Hash the specified password and the salt.
Creates a gen_server process as part of a supervision tree.

Link to this section Types

-type state() :: #state{size :: 0, busy :: 0, requests :: queue:queue(), ports :: queue:queue()}.

Link to this section Functions

-spec available(Pid) -> Result when Pid :: pid(), Result :: ok.
Asynchronosly check if Pid in #state:requests queue or not.
-spec gen_salt() -> Result when Result :: {ok, Salt}, Salt :: [byte()].
Generate a random text salt.
-spec gen_salt(Rounds) -> Result when Rounds :: bcrypt:rounds(), Result :: {ok, Salt}, Salt :: [byte()].
Generate a random text salt. Rounds defines the complexity of the hashing, increasing the cost as 2^log_rounds.
Hash the specified password and the salt.
-spec start_link() -> Result
              when
                  Result :: {ok, Pid} | ignore | {error, Error},
                  Pid :: pid(),
                  Error :: {already_started, Pid} | term().
Creates a gen_server process as part of a supervision tree.