Skip to content
Promise version of Node.js crypto module.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
UNLICENSE
index.js
package.json
test.js

README.md

crypto-promise npm version

Promise version of Node.js crypto module.

Example

const crypto = require('crypto-promise')

const test = async () => {
  const hash = await crypto.hash('md5')('hello')
  hash.toString('hex') // 5d41402abc4b2a76b9719d911017c592

  const hmac = await crypto.hmac('sha1', 'secret')('hello')
  hmac.toString('hex') // 5112055c05f944f85755efc5cd8970e194e9f45b

  const cipher = await crypto.cipher('aes256', 'secret')('hello')
  cipher.toString('hex') // f824105d6cadf7776b130cd80fdfeabf

  const decipher = await crypto.decipher('aes256', 'secret')('f824105d6cadf7776b130cd80fdfeabf', 'hex')
  decipher.toString() // hello

  const rand = await crypto.randomBytes(16)
  rand.length // 16
}

test()
You can’t perform that action at this time.