bcryptDigest function
BcryptHashDigest
bcryptDigest(
- List<
int> password, { - List<
int> ? salt, - BcryptVersion version = BcryptVersion.$2b,
- BcryptSecurity security = BcryptSecurity.good,
- int? nb,
Generate a secure password using the Bcrypt algorithm.
Bcrypt is a password hashing algorithm based on the Blowfish cipher. It uses a unique salt and a configurable cost factor to prevent rainbow table attacks and remain secure as hardware improves. Bcrypt's iterative hashing and expensive key setup phase ensure resistance to brute-force attacks.
Parameters:
password
: The password to hash. The algorithm uses first 72 bytes, and the rest are ignored.salt
: An randomly generated 16-byte string.nb
: Number of rounds in terms of power of 2. 0 <nb
< 31version
: The BcryptVersion to use. Default BcryptVersion.$2bsecurity
: The default parameter source fornb
if not provided (default is BcryptSecurity.good).
Implementation
BcryptHashDigest bcryptDigest(
List<int> password, {
List<int>? salt,
BcryptVersion version = BcryptVersion.$2b,
BcryptSecurity security = BcryptSecurity.good,
int? nb,
}) =>
Bcrypt(
version: version,
salt: salt,
cost: nb ?? security.nb,
).convert(password);