Advertisement
Guest User

processdeed.js

a guest
Oct 28th, 2014
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Crypto = require('crypto');
  2. var BigInteger = require('bigi');
  3. var Bitcoin = require('bitcoinjs-lib');
  4. var fs = require('fs');
  5. var bs58 = require('bs58');
  6.  
  7. fs.readFile(process.argv[2], "utf8", function(err, data) {
  8.   if(err) throw err;
  9.   console.log(data);
  10.  
  11.   dataStripped = data.replace(/\n$/, '');
  12.  
  13.   var shasum1 = Crypto.createHash('sha256');
  14.   shasum1.update(dataStripped);
  15.   var hex = shasum1.digest('hex');
  16. //console.log('sha256sum: ' + hex);
  17.  
  18.   var b58str = bs58.encode(new Buffer(hex, 'hex'));
  19.   console.log('DEED ID: ' + b58str);
  20.  
  21.   var shasum2 = Crypto.createHash('sha256');
  22.   shasum2.update(b58str);
  23.   hex = shasum2.digest('hex');
  24.   console.log('EXPONENT: ' + hex);
  25.  
  26.   b58str = bs58.encode(new Buffer(hex, 'hex'));
  27. //console.log('b58 exponent: ' + b58str);
  28.  
  29.   var privateKey = new Bitcoin.ECKey(new BigInteger(hex, 16), false);
  30.   console.log('PRIVATE KEY: ' + privateKey.toWIF());
  31.   console.log('PUBLIC KEY: ' + privateKey.pub.getAddress().toString());
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement