Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.create_address = function(seed) {
- var keys = {};
- var first;
- if (seed.length !== 64) {
- first = this.keccak(seed, seed.length / 2, 32);
- } else {
- first = seed;
- //changing the above to "first = this.sc_reduce32(seed)" would fix mymonero as well, as long as no one is using a
- //"mymonero" 25-word seed (they really shouldn't be)
- }
- keys.spend = this.generate_keys(first);
- var second = this.keccak(keys.spend.sec, 32, 32);
- //the above can't be used to "fix" mymonero, because it'd break the 13 word seeds
- //mymonero has "var second = this.keccak(first, 32, 32);" which means it ignores whether a seed has been reduced
- keys.view = this.generate_keys(second);
- keys.public_addr = this.pubkeys_to_string(keys.spend.pub, keys.view.pub);
- return keys;
- };
- function genwallet(lang)
- {
- if (lang!=null) {
- current_lang = lang;
- }
- else {
- seed = cnUtil.rand_32();
- //to make compatible with mymonero, replace with "seed = cnUtil.sc_reduce32(cnUtil.rand_32());"
- keys = cnUtil.create_address(seed);
- }
- //since mymonero ignores whether a seed has been reduced, the way to "fix" it is to only create reduced seeds
- //simplewallet does this, but *will* accept non-reduced seeds, and "properly" create the viewkey by hashing the private spend key
- //instead of the seed
- //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