SHOW:
|
|
- or go back to the newest paste.
| 1 | /*Stealth Short Payment IDs - proposals for shortening displayed payment IDs (to 32 bit), keeping full 32 byte "actual" payment IDs, AND incorporating a stealth feature to improve anonymity*/ | |
| 2 | ||
| 3 | //idea 1d | |
| 4 | var rkeys = {};
| |
| 5 | rkeys = create_address(rand_32()); //for testing obviously | |
| 6 | var payId = "0e0eedd4"; | |
| 7 | var payIdHash = cn_fast_hash(payID.ID); | |
| 8 | var txkey = random_keypair(); //same keypair used for tx | |
| 9 | var der = generate_key_derivation(rkeys.view.pub, txkey.sec); | |
| 10 | var payIdOutput = derive_public_key(der, -1, rkeys.spend.pub); | |
| 11 | var realPayId = hexXor(payIdOutput, payIdHash); //JS can only xor numbers, made up function to xor hex strings | |
| 12 | ||
| 13 | /*Note on output index in derive_public/secret_key operations: -1 actually works in JS, but it should be tested and reviewed before actually using it. For ideas 1a and 1b, an index of 0 can safely be used because the pub/sec keys being used are not the same as the rest of the outputs in the TX. For 1c and 1d, 1> last real output index could be used instead of -1.*/ | |
| 14 | ||
| 15 | ||
| 16 | //old ideas | |
| 17 | //ordered by cost (highest first) | |
| 18 | //idea 1a | |
| 19 | var rkeys = {};
| |
| 20 | rkeys = create_address(rand_32()); //for testing obviously | |
| 21 | var payId = {};
| |
| 22 | payId.id = "0e0eedd4"; //for example, 32 bit; an integrated address like this would be 101 base58 characters instead of 139 now | |
| 23 | payId.sec = sc_reduce32(cn_fast_hash(payId.id)); //not used | |
| 24 | payId.pub = sec_key_to_pub(payId.sec); | |
| 25 | var txkey = random_keypair(); //same keypair used for tx | |
| 26 | var der = generate_key_derivation(rkeys.view.pub, txkey.sec); //same derivation as the TX itself | |
| 27 | var realPayId = derive_public_key(der, -1, payId.pub); | |
| 28 | ||
| 29 | //idea 1b | |
| 30 | var rkeys = {};
| |
| 31 | rkeys = create_address(rand_32()); //for testing obviously | |
| 32 | var payId = {};
| |
| 33 | payId.id = "0e0eedd4"; | |
| 34 | payId.sec = sc_reduce32(cn_fast_hash(payId.id)); /*I do not know if sc_reduce32 needs to be used, as we don't need a "real" | |
| 35 | scalar for our realPayId. It appears to work without after numerous tests (in JS at least), but then again sc_reduce32 costs | |
| 36 | very little.*/ | |
| 37 | var txkey = random_keypair(); //same keypair used for tx | |
| 38 | var der = generate_key_derivation(rkeys.view.pub, txkey.sec); | |
| 39 | var realPayId = derive_secret_key(der, -1, payId.sec); | |
| 40 | ||
| 41 | //idea 1c | |
| 42 | var rkeys = {};
| |
| 43 | rkeys = create_address(rand_32()); //for testing obviously | |
| 44 | var shortPayId = "0e0eedd4"; | |
| 45 | var txkey = random_keypair(); //same keypair used for tx | |
| 46 | var der = generate_key_derivation(rkeys.view.pub, txkey.sec); | |
| 47 | var payIdOutput = derive_public_key(der, -1, rkeys.spend.pub); | |
| 48 | - | /*Note on output index in derive_public/secret_key operations: -1 actually works in JS, but it should be tested and reviewed before actually using it. For ideas 1a and 1b, an index of 0 can safely be used because the pub/sec keys being used are not the same as the rest of the outputs in the TX. For 1c and 1d, -1 or 1> than last real output index could be used.*/ |
| 48 | + | |
| 49 | ||
| 50 | //cost analysis | |
| 51 | /*1a: expensive, requires sec_key_to_pub (can be one time) and derive_public_key operations for *every* (or 50% on average to find the match) payment ID (that a firm is tracking) for *every* transaction that has outputs belonging to the firm; for a large firm with potentially millions of payment IDs it just costs too much | |
| 52 | 1b: here we get rid of the sec_key_to_pub and derive_public_key operations in favor of a single derive_secret_key operation; it costs less, but not significantly so since sec_key_to_pub can be stored in 1a | |
| 53 | 1c: here we replace the "many" operation (derive_public_key or derive_secret_key) with a hash of the short ID plus a portion of an output public key; estimate 2 orders of magnitude or more reduction in cost, making 1c (or a variant) probably feasible | |
| 54 | - | 1d: here we use the output public key as an encryption key of sorts, removing the "many" operation entirely; cost becomes negligible, regardless of the size of known ID set, as it can just be decrypted and compared with known ID hashes*/ |
| 54 | + | 1d: here we use the output public key as an encryption key of sorts, removing the "many" operation entirely; cost becomes negligible, regardless of the size of known ID set, as it can just be decrypted and compared with known ID hashes*/ |