Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

New password hashing method

I created this code that can hash passwords. It has a secure salt and it uses key stretching, which is also used by bcrypt to make the password hashing process slower
do you think that this is secure?


[@ hasher]$ cat main.js
const crypto = require('crypto');

test = Date.now();

let password = 'hi';

const sha = (thing) => {
return crypto.createHash('sha256').update(thing).digest('hex');
};

const difficulty = 19; // 2 difficulty
const salt = crypto.randomBytes(16).toString('hex');

password = `${salt}:${password}`;

for (let i = 0; i < 2
difficulty; i++) {
password = sha(password);
};

const wCrypted = `${difficulty}:${salt}:${password}`;

testa = Date.now();
console.log(testa - test);
console.log(wCrypted);

[@ hasher]$ node main.js
728
19:28c1122a06cffad80cbda72b04912553:0375e3064e3cc900a5c5a9d56a7d683e77cb526db5dfcd325db112679fb8e8cf
[@ hasher]$


I know the code isn't written very well, but this is just a test script that I am creating; it's not the actual code


Possibly Related Threads...
Thread / Author Replies Views Last Post
by blueroseMar 13, 2024 10:39 AM 1 109 Mar 13, 2024 10:39 AM
Last Post: Bastille
by c7rl0v3rr1d3Mar 19, 2021 09:37 AM 3 129 Mar 19, 2021 09:37 AM
Last Post: webworker
by LOLX156Mar 8, 2020 02:11 PM 2 131 Mar 8, 2020 02:11 PM
Last Post: otap1443