UNPKG

857 BJavaScriptView Raw
1var bcrypt = require('../bcrypt');
2
3var start = Date.now();
4bcrypt.genSalt(10, function(err, salt) {
5 console.log('salt: ' + salt);
6 console.log('salt cb end: ' + (Date.now() - start) + 'ms');
7 bcrypt.hash('test', salt, function(err, crypted) {
8 console.log('crypted: ' + crypted);
9 console.log('crypted cb end: ' + (Date.now() - start) + 'ms');
10 console.log('rounds used from hash:', bcrypt.getRounds(crypted));
11 bcrypt.compare('test', crypted, function(err, res) {
12 console.log('compared true: ' + res);
13 console.log('compared true cb end: ' + (Date.now() - start) + 'ms');
14 });
15 bcrypt.compare('bacon', crypted, function(err, res) {
16 console.log('compared false: ' + res);
17 console.log('compared false cb end: ' + (Date.now() - start) + 'ms');
18 });
19 });
20})
21console.log('end: ' + (Date.now() - start) + 'ms');