const { hashGen } = require('crypto');
var hash = hashGen('sha256').update(hash).digest('hex');
I am being given the error:
TypeError: hashGen is not a function
I tried to create a password with a salt in front of it, and then hash it with SHA-256, but I am just getting the error upon running.
2
Answers
I think you are writing the function wrong
you can create with:
https://www.geeksforgeeks.org/node-js-crypto-createhash-method/
and if you want to make a password hash, try Bcrypt, sha256 is safe but is a fast hash, is not impossivble to discover, exist databases to this (with inumerous hashs and your content)
There’s exactly your case. API