Crypt is a standard Deno module that it is used to compute the hash of passwords.
import * as bcrypt from 'https://deno.land/x/crypt@v0.1.0/bcrypt.ts';
To hash a password (with auto-generated salt):
const hash = await bcrypt.hash('Crypt');
To check a password:
const result = await bcrypt.compare('Crypt', hash);
To hash a password with a manually generated salt:
const salt = await bcrypt.genSalt(8);
const hash = await bcrypt.hash('Crypt', salt);
To hash a password (with auto-generated salt):
const hash = bcrypt.hash('Crypt');
To check a password:
const result = bcrypt.compare('Crypt', hash);
To hash a password with a manually generated salt:
const salt = bcrypt.genSaltSync(8);
const hash = bcrypt.hashSync("Crypt", salt);
Details changes for each release are documented in the CHANGELOG.md.
If you think any of the Crypt
can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.
We’d love to have your helping hand on contributions to Crypt
by forking and sending a pull request!
Your contributions are heartily ♡ welcome, recognized and appreciated. (✿◠‿◠)
How to contribute:
Author: Bunlong
Source Code: https://github.com/Bunlong/crypt
#deno #nodejs #node #javascript