Skip to content

Instantly share code, notes, and snippets.

@makevoid
Created February 23, 2017 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makevoid/56baccfa3728265ebfd3a3ad745da954 to your computer and use it in GitHub Desktop.
Save makevoid/56baccfa3728265ebfd3a3ad745da954 to your computer and use it in GitHub Desktop.
keythereum-js example
`"use strict"`
const keythereum = require('keythereum')
const c = console
// private key from bitcoin
let privateKey = "10f2fb3aaac742b2f6c2a0a830d5330846633c8a139696cca2c0e379944f62b2"
let password = "bla"
// ---
let options = {
kdf: "pbkdf2",
cipher: "aes-128-ctr",
kdfparams: {
c: 262144,
dklen: 32,
prf: "hmac-sha256"
}
}
var dk = keythereum.create() // creates a sample key
dk.privateKey = new Buffer(privateKey)
let keyObject = keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options)
c.log(keyObject)
{
"dependencies": {
"keythereum": "^0.3.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment