Closed
Description
Node.js Version
v22.13.0
NPM Version
v11.0.0
Operating System
Windows 10 22H2 (Build 19045.5371)
Subsystem
crypto
Description
Hey, i was searching a good way to store passwords/private data in a database using hashing, would this be a secure way?
const crypto = require('crypto');
const randomSalt = crypto.randomBytes(64).toString('hex'); //generate an unique salt for every password
const data = "hello world"
const saltedData = data + randomSalt;
const hash = crypto.createHash('sha3-512');
hash.update(saltedData);
const hashedData = hash.digest('hex');
//then store hashedData in a database
Minimal Reproduction
- Run the code above
Output
No response
Before You Submit
- I have looked for issues that already exist before submitting this
- My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask