public void transformBlock(byte[] in, int inOff, byte[] out, int outOff) { if (key1 == null) { throw new IllegalStateException("DESede engine not initialised!"); } if (encrypt) { desFunc(key1, in, inOff, out, outOff); desFunc(key2, out, outOff, out, outOff); desFunc(key3, out, outOff, out, outOff); } else { desFunc(key3, in, inOff, out, outOff); desFunc(key2, out, outOff, out, outOff); desFunc(key1, out, outOff, out, outOff); } }
/** * initialise a DES cipher. * * @param encrypting * whether or not we are for encryption. * @param key * the parameters required to set up the cipher. * @exception IllegalArgumentException * if the params argument is inappropriate. */ public void init(boolean encrypting, byte[] key) { key1 = generateWorkingKey(encrypting, key, 0); key2 = generateWorkingKey(!encrypting, key, 8); key3 = generateWorkingKey(encrypting, key, 16); encrypt = encrypting; }
/** * initialise a DES cipher. * * @param encrypting * whether or not we are for encryption. * @param key * the parameters required to set up the cipher. * @exception IllegalArgumentException * if the params argument is inappropriate. */ public void init(boolean encrypting, byte[] key) { key1 = generateWorkingKey(encrypting, key, 0); key2 = generateWorkingKey(!encrypting, key, 8); key3 = generateWorkingKey(encrypting, key, 16); encrypt = encrypting; }
public void transformBlock(byte[] in, int inOff, byte[] out, int outOff) { if (key1 == null) { throw new IllegalStateException("DESede engine not initialised!"); } if (encrypt) { desFunc(key1, in, inOff, out, outOff); desFunc(key2, out, outOff, out, outOff); desFunc(key3, out, outOff, out, outOff); } else { desFunc(key3, in, inOff, out, outOff); desFunc(key2, out, outOff, out, outOff); desFunc(key1, out, outOff, out, outOff); } }
/** * initialise a DES cipher. * * @param encrypting * whether or not we are for encryption. * @param key * the parameters required to set up the cipher. * @exception IllegalArgumentException * if the params argument is inappropriate. */ public void init(boolean encrypting, byte[] key) { key1 = generateWorkingKey(encrypting, key, 0); key2 = generateWorkingKey(!encrypting, key, 8); key3 = generateWorkingKey(encrypting, key, 16); encrypt = encrypting; }
public void transformBlock(byte[] in, int inOff, byte[] out, int outOff) { if (key1 == null) { throw new IllegalStateException("DESede engine not initialised!"); } if (encrypt) { desFunc(key1, in, inOff, out, outOff); desFunc(key2, out, outOff, out, outOff); desFunc(key3, out, outOff, out, outOff); } else { desFunc(key3, in, inOff, out, outOff); desFunc(key2, out, outOff, out, outOff); desFunc(key1, out, outOff, out, outOff); } }