P[i] = P[i] ^ streamtoword(key, koffp); lr[0] ^= streamtoword(data, doffp); lr[1] ^= streamtoword(data, doffp); encipher(lr, 0); P[i] = lr[0]; lr[0] ^= streamtoword(data, doffp); lr[1] ^= streamtoword(data, doffp); encipher(lr, 0); S[i] = lr[0];
/** * Key the Blowfish cipher. * * @param key an array containing the key */ private void key(byte[] key) { int i; int[] koffp = {0}; int[] lr = {0, 0}; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { P[i] = P[i] ^ streamtoword(key, koffp); } for (i = 0; i < plen; i += 2) { encipher(lr, 0); P[i] = lr[0]; P[i + 1] = lr[1]; } for (i = 0; i < slen; i += 2) { encipher(lr, 0); S[i] = lr[0]; S[i + 1] = lr[1]; } }
P[i] = P[i] ^ streamtoword(key, koffp); lr[0] ^= streamtoword(data, doffp); lr[1] ^= streamtoword(data, doffp); encipher(lr, 0); P[i] = lr[0]; lr[0] ^= streamtoword(data, doffp); lr[1] ^= streamtoword(data, doffp); encipher(lr, 0); S[i] = lr[0];
/** * Key the Blowfish cipher. * * @param key an array containing the key */ private void key(byte key[]) { int i; int koffp[] = {0}; int lr[] = {0, 0}; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { P[i] = P[i] ^ streamtoword(key, koffp); } for (i = 0; i < plen; i += 2) { encipher(lr, 0); P[i] = lr[0]; P[i + 1] = lr[1]; } for (i = 0; i < slen; i += 2) { encipher(lr, 0); S[i] = lr[0]; S[i + 1] = lr[1]; } }