Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Crypto = require('crypto');
- var BigInteger = require('bigi');
- var Bitcoin = require('bitcoinjs-lib');
- var fs = require('fs');
- var bs58 = require('bs58');
- fs.readFile(process.argv[2], "utf8", function(err, data) {
- if(err) throw err;
- console.log(data);
- dataStripped = data.replace(/\n$/, '').replace(/(\r)?\n/g, "\r\n");
- var shasum = Crypto.createHash('sha256');
- shasum.update(dataStripped);
- var hex = shasum.digest('hex');
- //console.log('sha256sum: ' + hex);
- var b58str = bs58.encode(new Buffer(hex, 'hex'));
- console.log('DEED ID: ' + b58str);
- var shasum2 = Crypto.createHash('sha256');
- shasum2.update(b58str);
- hex = shasum2.digest('hex');
- console.log('EXPONENT: ' + hex);
- b58str = bs58.encode(new Buffer(hex, 'hex'));
- //console.log('b58 string: ' + b58str);
- var privateKey = new Bitcoin.ECKey(new BigInteger(hex, 16), false);
- console.log('PRIVATE KEY: ' + privateKey.toWIF());
- console.log('PUBLIC KEY: ' + privateKey.pub.getAddress().toString());
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement