Guest User

Untitled

a guest
Aug 10th, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     this.create_address = function(seed) {
  2.         var keys = {};
  3.         var first;
  4.         if (seed.length !== 64) {
  5.             first = this.keccak(seed, seed.length / 2, 32);
  6.         } else {
  7.             first = seed;
  8.             //changing the above to "first = this.sc_reduce32(seed)" would fix mymonero as well, as long as no one is using a
  9.             //"mymonero" 25-word seed (they really shouldn't be)
  10.         }
  11.         keys.spend = this.generate_keys(first);
  12.         var second = this.keccak(keys.spend.sec, 32, 32);
  13.         //the above can't be used to "fix" mymonero, because it'd break the 13 word seeds
  14.     //mymonero has "var second = this.keccak(first, 32, 32);" which means it ignores whether a seed has been reduced
  15.         keys.view = this.generate_keys(second);
  16.         keys.public_addr = this.pubkeys_to_string(keys.spend.pub, keys.view.pub);
  17.         return keys;
  18.     };
  19.  
  20. function genwallet(lang)
  21. {
  22.   if (lang!=null) {
  23.     current_lang = lang;
  24.   }
  25.   else {
  26.     seed = cnUtil.rand_32();
  27.     //to make compatible with mymonero, replace with "seed = cnUtil.sc_reduce32(cnUtil.rand_32());"
  28.     keys = cnUtil.create_address(seed);
  29.   }
  30.  
  31.  
  32. //since mymonero ignores whether a seed has been reduced, the way to "fix" it is to only create reduced seeds
  33. //simplewallet does this, but *will* accept non-reduced seeds, and "properly" create the viewkey by hashing the private spend key
  34. //instead of the seed
  35. //properly "fixing" mymonero instead is kinda possible, but there's a possibility some seeds would break
Advertisement
Add Comment
Please, Sign In to add comment