private static byte[] cryptoProDiversify(byte[] K, byte[] ukm, byte[] sBox) { for (int i = 0; i != 8; i++) { int sOn = 0; int sOff = 0; for (int j = 0; j != 8; j++) { int kj = Pack.littleEndianToInt(K, j * 4); if (bitSet(ukm[i], j)) { sOn += kj; } else { sOff += kj; } } byte[] s = new byte[8]; Pack.intToLittleEndian(sOn, s, 0); Pack.intToLittleEndian(sOff, s, 4); GCFBBlockCipher c = new GCFBBlockCipher(new GOST28147Engine()); c.init(true, new ParametersWithIV(new ParametersWithSBox(new KeyParameter(K), sBox), s)); c.processBlock(K, 0, K, 0); c.processBlock(K, 8, K, 8); c.processBlock(K, 16, K, 16); c.processBlock(K, 24, K, 24); } return K; }
public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { this.processBytes(in, inOff, cfbEngine.getBlockSize(), out, outOff); return cfbEngine.getBlockSize(); }
public GCFB() { super(new BufferedBlockCipher(new GCFBBlockCipher(new GOST28147Engine())), 64); } }
new GCFBBlockCipher(baseEngine)));
private static byte[] cryptoProDiversify(byte[] K, byte[] ukm, byte[] sBox) { for (int i = 0; i != 8; i++) { int sOn = 0; int sOff = 0; for (int j = 0; j != 8; j++) { int kj = Pack.littleEndianToInt(K, j * 4); if (bitSet(ukm[i], j)) { sOn += kj; } else { sOff += kj; } } byte[] s = new byte[8]; Pack.intToLittleEndian(sOn, s, 0); Pack.intToLittleEndian(sOff, s, 4); GCFBBlockCipher c = new GCFBBlockCipher(new GOST28147Engine()); c.init(true, new ParametersWithIV(new ParametersWithSBox(new KeyParameter(K), sBox), s)); c.processBlock(K, 0, K, 0); c.processBlock(K, 8, K, 8); c.processBlock(K, 16, K, 16); c.processBlock(K, 24, K, 24); } return K; }
public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { this.processBytes(in, inOff, cfbEngine.getBlockSize(), out, outOff); return cfbEngine.getBlockSize(); }