Advertisement
Guest User

processdeed.js

a guest
Nov 3rd, 2014
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  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$/, '').replace(/(\r)?\n/g, "\r\n");
  12.  
  13. var shasum = Crypto.createHash('sha256');
  14. shasum.update(dataStripped);
  15. var hex = shasum.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 string: ' + 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