npm install non-blocking-bcrypt-nodejs --save
lets jump to some examples
rounds
- [OPTIONAL] - the number of rounds to process the data for. (default - 10)
const bcrypt = require('non-blocking-bcrypt-nodejs')
(async () =>{
try {
const {salt} = await bcrypt.genSalt()
}
catch(err){
}
})();
data
- [REQUIRED] - the data to be encrypted.salt
- [REQUIRED] - the salt to be used in encryption.
const bcrypt = require('non-blocking-bcrypt-nodejs')
(async () =>{
try {
const {salt} = await nonBlockingBcrypt.genSalt();
const {hash} = await nonBlockingBcrypt.genHash(salt, 'sdsasdsafasf');
}
catch(err){
}
})();
data
- [REQUIRED] - the data to be encrypted.
const bcrypt = require('non-blocking-bcrypt-nodejs')
(async () =>{
try {
const {hash} = await nonBlockingBcrypt.saltAndHash( 'sdsasdsafasf');
}
catch(err){
}
})();
data
- [REQUIRED] - data to compare.encrypted
- [REQUIRED] - data to be compared to.
const bcrypt = require('non-blocking-bcrypt-nodejs')
(async () =>{
try {
const {salt} = await nonBlockingBcrypt.genSalt();
const {hash} = await nonBlockingBcrypt.genHash(salt, 'sdsasdsafasf');
const match = await nonBlockingBcrypt.compare('sdsasdsafasf', hash);
}
catch(err){
}
})();
npm test