mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Added new example files and renamed existing ones
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user