diff options
author | Joel Kronqvist <joelkronqvist@proton.me> | 2023-06-24 07:49:18 +0000 |
---|---|---|
committer | Joel Kronqvist <joelkronqvist@proton.me> | 2023-06-24 07:49:18 +0000 |
commit | 7f59612f4ad1061c99ae53ef92baf04511b7f9af (patch) | |
tree | 594a1a33660c34be5fc607e3d6b9f521a960ea04 /server.js | |
parent | 53dfdded8181e6bf8987795813e128717ef9860c (diff) | |
download | LYLLRuoka-7f59612f4ad1061c99ae53ef92baf04511b7f9af.tar.gz LYLLRuoka-7f59612f4ad1061c99ae53ef92baf04511b7f9af.zip |
Changed to PBKDF2
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -9,7 +9,7 @@ const open = require("./Functions/open.js"); const strFuncs = require("./Functions/stringFuncs.js"); const dateFuncs = require("./Functions/dateFuncs.js"); const updateDB = require("./update.js"); -const { createHash} = require("node:crypto"); +const { pbkdf2 } = require("./Functions/pbkdf2promise.js"); const SHIFTPATH = "../Updation/shifts.txt"; const CLASSPATH = "../Updation/classes.txt"; @@ -100,9 +100,15 @@ async function init() return; } - const hashObj = createHash("sha256"); - hashObj.update(suppliedPassword); - let suppliedPassHash = hashObj.digest('hex'); + + let suppliedPassHash = await pbkdf2( + suppliedPassword, + 'salts protect from dictionary attacks, but we will have ~1 password.', + 10000, + 64, + 'sha512', + ); + suppliedPassHash = suppliedPassHash.toString('hex'); console.log(suppliedPassHash); let passHashes = await open.file(PASSPATH); passHashes = passHashes.toString('utf-8').split("\n"); |