Skip to main content
The Bun.password.hash() function provides a fast, built-in mechanism for securely hashing passwords in Bun. No third-party dependencies are required.

By default, this uses the Argon2id algorithm. Pass a second argument to Bun.password.hash() to use a different algorithm or configure the hashing parameters.

Bun also implements the bcrypt algorithm. Specify algorithm: "bcrypt" to use it.

Use Bun.password.verify() to verify a password. The algorithm and its parameters are stored in the hash itself, so re-specifying configuration is unnecessary.

See Docs > API > Hashing for complete documentation.