public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { if (!initialised) { throw new IllegalStateException("Null engine not initialised"); } if ((inOff + blockSize) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + blockSize) > out.length) { throw new OutputLengthException("output buffer too short"); } for (int i = 0; i < blockSize; ++i) { out[outOff + i] = in[inOff + i]; } return blockSize; }
public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { if (subKeys == null) { throw new IllegalStateException("GOST3412_2015 engine not initialised"); } if ((inOff + BLOCK_SIZE) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + BLOCK_SIZE) > out.length) { throw new OutputLengthException("output buffer too short"); } GOST3412_2015Func(in, inOff, out, outOff); return BLOCK_SIZE; }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (workingKey == null) { throw new IllegalStateException("GOST28147 engine not initialised"); } if ((inOff + BLOCK_SIZE) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + BLOCK_SIZE) > out.length) { throw new OutputLengthException("output buffer too short"); } GOST28147Func(workingKey, in, inOff, out, outOff); return BLOCK_SIZE; }
private void outputBlock(byte[] output, int offset) { if (output.length < (offset + BLOCK_SIZE)) { throw new OutputLengthException("Output buffer too short"); } if (totalLength == 0) { initCipher(); } gCTRBlock(bufBlock, output, offset); if (forEncryption) { bufOff = 0; } else { System.arraycopy(bufBlock, BLOCK_SIZE, bufBlock, 0, macSize); bufOff = macSize; } }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (workingKey == null) { throw new IllegalStateException("IDEA engine not initialised"); } if ((inOff + BLOCK_SIZE) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + BLOCK_SIZE) > out.length) { throw new OutputLengthException("output buffer too short"); } ideaFunc(workingKey, in, inOff, out, outOff); return BLOCK_SIZE; }
public int processBytes(byte[] input, int inOff, int len, byte[] output, int outOff) { if (input.length - inOff < len) { throw new DataLengthException("Input buffer too short"); } if (output.length - inOff < len) { throw new OutputLengthException("Output buffer too short"); } if (len % blockSize != 0) { throw new IllegalArgumentException("Partial blocks not supported"); } for (int pos = 0; pos < len; pos += blockSize) { processBlock(input, inOff + pos, output, outOff + pos); } return len; }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (workingKey == null) { throw new IllegalStateException("DES engine not initialised"); } if ((inOff + BLOCK_SIZE) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + BLOCK_SIZE) > out.length) { throw new OutputLengthException("output buffer too short"); } desFunc(workingKey, in, inOff, out, outOff); return BLOCK_SIZE; }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (workingKey == null) { throw new IllegalStateException("DES engine not initialised"); } if ((inOff + BLOCK_SIZE) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + BLOCK_SIZE) > out.length) { throw new OutputLengthException("output buffer too short"); } desFunc(workingKey, in, inOff, out, outOff); return BLOCK_SIZE; }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (workingKey == null) { throw new IllegalStateException("GOST28147 engine not initialised"); } if ((inOff + BLOCK_SIZE) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + BLOCK_SIZE) > out.length) { throw new OutputLengthException("output buffer too short"); } GOST28147Func(workingKey, in, inOff, out, outOff); return BLOCK_SIZE; }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (workingKey == null) { throw new IllegalStateException("IDEA engine not initialised"); } if ((inOff + BLOCK_SIZE) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + BLOCK_SIZE) > out.length) { throw new OutputLengthException("output buffer too short"); } ideaFunc(workingKey, in, inOff, out, outOff); return BLOCK_SIZE; }
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException { if (inOff + len > in.length) { throw new DataLengthException("input buffer too small"); } if (outOff + len > out.length) { throw new OutputLengthException("output buffer too short"); } int inStart = inOff; int inEnd = inOff + len; int outStart = outOff; while (inStart < inEnd) { out[outStart++] = calculateByte(in[inStart++]); } return len; }
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException { if (!initialised) { throw new IllegalStateException(getAlgorithmName() + " not initialised"); } if ((inOff + len) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + len) > out.length) { throw new OutputLengthException("output buffer too short"); } for (int i = 0; i < len; i++) { out[outOff + i] = (byte)(in[inOff + i] ^ getByte()); } return len; }
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException { if (!initialised) { throw new IllegalStateException(getAlgorithmName() + " not initialised"); } if ((inOff + len) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + len) > out.length) { throw new OutputLengthException("output buffer too short"); } for (int i = 0; i < len; i++) { out[outOff + i] = (byte)(in[inOff + i] ^ getByte()); } return len; }
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException { if (!initialised) { throw new IllegalStateException(getAlgorithmName() + " not initialised"); } if ((inOff + len) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + len) > out.length) { throw new OutputLengthException("output buffer too short"); } for (int i = 0; i < len; i++) { out[outOff + i] = (byte)(in[inOff + i] ^ getByte()); } return len; }
public int doFinal(byte[] out, int outOff) throws DataLengthException, IllegalStateException { if (paddedKey == null) { throw new IllegalStateException(getAlgorithmName() + " not initialised"); } if (out.length - outOff < macSize) { throw new OutputLengthException("Output buffer too short"); } pad(); engine.update(invertedKey, 0, invertedKey.length); inputLength = 0; return engine.doFinal(out, outOff); }
public int doFinal(byte[] out, int outOff) throws DataLengthException, IllegalStateException { if (bufOff % buf.length != 0) { throw new DataLengthException("input must be a multiple of blocksize"); } //Last block xor(c, 0, buf, 0, cTemp); xor(cTemp, 0, kDelta, 0, c); engine.processBlock(c, 0, c, 0); if (macSize + outOff > out.length) { throw new OutputLengthException("output buffer too short"); } System.arraycopy(c, 0, out, outOff, macSize); return macSize; }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (!_initialised) { throw new IllegalStateException(getAlgorithmName()+" not initialised"); } if ((inOff + block_size) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + block_size) > out.length) { throw new OutputLengthException("output buffer too short"); } return (_forEncryption) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff); }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (!_initialised) { throw new IllegalStateException(getAlgorithmName()+" not initialised"); } if ((inOff + block_size) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + block_size) > out.length) { throw new OutputLengthException("output buffer too short"); } return (_forEncryption) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff); }
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (!_initialised) { throw new IllegalStateException(getAlgorithmName()+" not initialised"); } if ((inOff + block_size) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + block_size) > out.length) { throw new OutputLengthException("output buffer too short"); } return (_forEncryption) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff); }
public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { if (in.length - inOff < getBlockSize()) { throw new DataLengthException("input buffer too short"); } if (out.length - outOff < getBlockSize()) { throw new OutputLengthException("output buffer too short"); } processBytes(in, inOff, getBlockSize(), out, outOff); return getBlockSize(); }