@buntal/core - Security

hash

Password hashing utility function using bcrypt for secure password storage.

Source

View source on GitHub

Type Definition

function hash(password: string): string

hash.compare = function (password: string, hashed: string): boolean

Parameters

ParameterTypeRequiredDefaultDescription
passwordstring-Plain text password to hash

Methods

hash

Hashes a password using bcrypt with automatic salt generation.

Parameters

ParameterTypeRequiredDefaultDescription
passwordstring-Plain text password to hash

Returns

string

hash.compare

Compares a plain text password with a hashed password.

Parameters

ParameterTypeRequiredDefaultDescription
passwordstring-Plain text password
hashedstring-Previously hashed password

Returns

boolean

Last modified: 2025-06-10

Content-Length: 0