Crypto secure salt generator
npm install @kdf/salt
🎲 Crypto secure salt generator
Coded with ❤️ by Simone Primarosa.
``bash`
npm install --save @kdf/salt
`js
const gensalt = require('@kdf/salt');
gensalt(16).then(salt => {
console.log(salt);
// =>
console.log(salt.toString('base64'));
// => cCxuHMEHLibcglJOG88dIw==
console.log(salt.toString('hex'));
// => 702c6e1cc1072e26dc82524e1bcf1d23
})
`
Kind: global function
Returns: Promise.<Buffer> - The salt as a Buffer.
Access: public
| Param | Type | Description |
| --- | --- | --- |
| length | number | The length of the salt to be generated. Must be an integer within the range (0 <= length <= 2^31-1`). |
See also the list of [contributors][contributors] who participated in this project.
[new issue]: https://github.com/simonepri/node-kdf/issues/new
[contributors]: https://github.com/simonepri/node-kdf/contributors
[license]: https://github.com/simonepri/node-kdf/blob/master/packages/salt/license
[github:simonepri]: https://github.com/simonepri
[twitter:simoneprimarosa]: http://twitter.com/intent/user?screen_name=simoneprimarosa