Sometimes, we want to create random-salt-hash with crypto with Node.js and JavaScript.
In this article, we’ll look at how to create random-salt-hash with crypto with Node.js and JavaScript.
How to create random-salt-hash with crypto with Node.js and JavaScript?
To create random-salt-hash with crypto with Node.js and JavaScript, we can use the crypto.randomBytes
method.
For instance, we write:
const crypto = require('crypto')
const buf = crypto.randomBytes(16);
console.log(buf)
We call crypto.randomBytes
with 16 to create a buffer object with 16 random bytes.
Conclusion
To create random-salt-hash with crypto with Node.js and JavaScript, we can use the crypto.randomBytes
method.