Socket
Socket
Sign inDemoInstall

@kdf/salt

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kdf/salt

Crypto secure salt generator


Version published
Maintainers
1
Created
Source

kdf-salt

Latest version on npm Downloads on npm Project license
Lint status Test macOS status Test Ubuntu status Test Windows status
Codecov Coverage report Known Vulnerabilities Dependency Status
XO Code Style used AVA Test Runner used Istanbul Test Coverage used NI Scaffolding System used NP Release System used

🎲 Crypto secure salt generator
Coded with ❤️ by Simone Primarosa.

Install

npm install --save @kdf/salt

Usage

const gensalt = require('@kdf/salt');

gensalt(16).then(salt => {
  console.log(salt);
  // => <Buffer 70 2c 6e 1c c1 07 2e 26 dc 82 52 4e 1b cf 1d 23>
  console.log(salt.toString('base64'));
  // => cCxuHMEHLibcglJOG88dIw==
  console.log(salt.toString('hex'));
  // => 702c6e1cc1072e26dc82524e1bcf1d23
})

API

gensalt(length) ⇒ Promise.<Buffer>

Generates a cryptographically secure random string to be used as a password salt , using Node's built-in crypto.randomBytes() function.

Kind: global function
Returns: Promise.<Buffer> - The salt as a Buffer.
Access: public

ParamTypeDescription
lengthnumberThe length of the salt to be generated. Must be an integer within the range (0 <= length <= 2^31-1).

Contributing

Contributions are REALLY welcome and if you find a security flaw in this code, PLEASE report it.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the license file for details.

Keywords

FAQs

Package last updated on 05 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc