Added new example files and renamed existing ones

This commit is contained in:
smiddy007
2023-03-26 21:53:22 -04:00
committed by GitHub
parent ccf152df00
commit ad527b8f69
4 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
const crypto = require('crypto-js')
function hashPassword(email, password) {
var algo = crypto.algo.SHA512.create()
algo.update(password, 'utf-8') // BAD
algo.update(email.toLowerCase(), 'utf-8')
var hash = algo.finalize()
return hash.toString(crypto.enc.Base64)
}

View File

@@ -0,0 +1,8 @@
const crypto = require('crypto-js')
function hashPassword(email, password) {
var algo = crypto.algo.PBKDF2.create()
algo.update(password, 'utf-8') // GOOD
algo.update(email.toLowerCase(), 'utf-8')
var hash = algo.finalize()
return hash.toString(crypto.enc.Base64)
}