Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctrl-alt-deseat/ctrlpanel-pbkdf2
Small package exporting a PBKDF2 function that works both in Node.js and in browsers
https://github.com/ctrl-alt-deseat/ctrlpanel-pbkdf2
Last synced: 3 months ago
JSON representation
Small package exporting a PBKDF2 function that works both in Node.js and in browsers
- Host: GitHub
- URL: https://github.com/ctrl-alt-deseat/ctrlpanel-pbkdf2
- Owner: ctrl-alt-deseat
- Created: 2017-12-18T17:33:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-13T10:54:36.000Z (over 4 years ago)
- Last Synced: 2024-07-03T08:13:58.725Z (4 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# PBKDF2 for Node.js and Browsers
Small package exporting a PBKDF2 function that works both in Node.js and in browsers.
## Installation
```sh
npm install --save @ctrlpanel/pbkdf2
```## Usage
```js
const pbkdf2 = require('@ctrlpanel/pbkdf2')const password = Buffer.from('super secret')
const salt = Buffer.from('salt')pbkdf2(password, salt, 500000, 32, 'SHA-512').then((result) => {
console.log(result)
//=> ArrayBuffer { byteLength: 32 }
})
```## API
### `pbkdf2(password, salt, iterations, keylen, digest) => ArrayBuffer`
- password: `ArrayBuffer | Uint8Array | Buffer` - The password to base the derivation on
- salt: `ArrayBuffer | Uint8Array | Buffer` - The salt used when deriving
- iterations: `number` - Number of iterations
- keylen: `number` - Byte length of output key
- digest: `'SHA-256' | 'SHA-384' | 'SHA-512'` - Hash algorithm to useDerive a key from `password`, and return it as an `ArrayBuffer`.