Changeset f69f06b


Ignore:
Timestamp:
Nov 23, 2011 10:25:36 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
f630d2dd
Parents:
5a93405
Message:
  • Tunnel encryption: More efficient XOR
Location:
router/java/src/net/i2p/router/tunnel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/tunnel/HopProcessor.java

    r5a93405 rf69f06b  
    101101    private final void encrypt(byte data[], int offset, int length) {
    102102        for (int off = offset + IV_LENGTH; off < length; off += IV_LENGTH) {
    103             DataHelper.xor(data, off - IV_LENGTH, data, off, data, off, IV_LENGTH);
     103            //DataHelper.xor(data, off - IV_LENGTH, data, off, data, off, IV_LENGTH);
     104            for (int j = 0; j < IV_LENGTH; j++) {
     105                data[off + j] ^= data[(off - IV_LENGTH) + j];
     106            }
    104107            _context.aes().encryptBlock(data, off, _config.getLayerKey(), data, off);
    105108        }
  • router/java/src/net/i2p/router/tunnel/OutboundGatewayProcessor.java

    r5a93405 rf69f06b  
    9494            System.arraycopy(orig, off, cur, 0, HopProcessor.IV_LENGTH);
    9595            ctx.aes().decryptBlock(orig, off, config.getLayerKey(), orig, off);
    96             DataHelper.xor(prev, 0, orig, off, orig, off, HopProcessor.IV_LENGTH);
     96            //DataHelper.xor(prev, 0, orig, off, orig, off, HopProcessor.IV_LENGTH);
     97            for (int j = 0; j < HopProcessor.IV_LENGTH; j++) {
     98                orig[off + j] ^= prev[j];
     99            }
    97100            byte xf[] = prev;
    98101            prev = cur;
Note: See TracChangeset for help on using the changeset viewer.