Created
August 24, 2014 06:40
-
-
Save JackTanRoo/1e77dc0371a1b0ff45b9 to your computer and use it in GitHub Desktop.
how should i generate the array of random numbers in Node, without access to window.crypto?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//helloblock tutorial | |
var privateKey = "cND8kTK2zSJf1bTqaz5nZ2Pdqtv43kQNcwJ1Dp5XWtbRokJNS97N" | |
var ecKey = new bitcoin.ECKey(privateKey) | |
// .ECKey() now either takes an array of randomly generated numbers or a bigDecimal as parameter | |
// from bitcoinjs tutorial | |
var randArr = new Uint8Array(32) | |
window.crypto.getRandomValues(randArr) // | |
var privateKeyBytes = [] | |
for (var i = 0; i < randArr.length; ++i) | |
privateKeyBytes[i] = randArr[i] | |
var ecKey = new bitcoin.ECKey(privateKeyBytes) //So question: how should i generate the array of random numbers in Node, without access to window.crypto? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment