Advertisement
deseven

mysqlPasswordHash() node

Apr 4th, 2017
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const crypto = require('crypto');
  2.  
  3. var mysqlPasswordHash = function(password) {
  4.     var buffer = crypto.createHash('sha1').update(password).digest();
  5.     var hash = crypto.createHash('sha1').update(buffer).digest('hex');
  6.     return '*' + hash.toUpperCase();
  7. }
  8.  
  9. console.log(mysqlPasswordHash('qwerty'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement