{ } qjs-modules

bcrypt

Source: quickjs-bcrypt.c — module exports a flat list of functions.

Password hashing with the bcrypt algorithm (wraps libbcrypt).

Functions

FunctionArgsDescription
genSalt(rounds)0Generates a new bcrypt salt; the optional rounds cost factor controls work.
hash(password, salt)1Hashes password; if a salt is omitted one is generated. Returns the encoded hash string.
compare(password, hash)2Verifies password against an existing bcrypt hash, returning a boolean.

Constants

ConstantDescription
HASHSIZESize in bytes of an encoded hash.
SALTSIZESize in bytes of a generated salt.