View Source bcrypt_pool (bcrypt v1.2.2)
gen_server
behaviour.
Link to this section Summary
Functions
Asynchronously 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.
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{size :: 0, busy :: 0, requests :: queue:queue(), ports :: queue:queue()}.
Link to this section Functions
-spec available(Pid) -> Result when Pid :: pid(), Result :: ok.
Pid
in #state:requests
queue or not.
-spec gen_salt() -> Result when Result :: {ok, Salt}, Salt :: [byte()].
-spec gen_salt(Rounds) -> Result when Rounds :: bcrypt:rounds(), Result :: {ok, Salt}, Salt :: [byte()].
-spec is_worker_available() -> Result when Result :: boolean().
-spec start_link() -> Result
when
Result :: {ok, Pid} | ignore | {error, Error},
Pid :: pid(),
Error :: {already_started, Pid} | term().
gen_server
process as part of a supervision tree.