Package org.bouncycastle.crypto.engines
Class CAST6Engine
java.lang.Object
org.bouncycastle.crypto.engines.CAST5Engine
org.bouncycastle.crypto.engines.CAST6Engine
- All Implemented Interfaces:
BlockCipher
A class that provides CAST6 key encryption operations,
such as encoding data and generating keys.
All the algorithms herein are from the Internet RFC
RFC2612 - CAST6 (128bit block, 128-256bit key)
and implement a simplified cryptography interface.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[]protected int[]protected int[]protected int[]protected static final intprotected static final intFields inherited from class org.bouncycastle.crypto.engines.CAST5Engine
MAX_ROUNDS, RED_ROUNDS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidCAST_Decipher(int A, int B, int C, int D, int[] result) Does the 12 quad rounds rounds to decrypt the block.protected final voidCAST_Encipher(int A, int B, int C, int D, int[] result) Does the 12 quad rounds rounds to encrypt the block.protected intdecryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) Decrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.protected intencryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) Encrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.Return the name of the algorithm the cipher implements.intReturn the block size for this cipher (in bytes).voidreset()Reset the cipher.protected voidsetKey(byte[] key) Methods inherited from class org.bouncycastle.crypto.engines.CAST5Engine
Bits32ToBytes, Bits32ToInts, BytesTo32bits, CAST_Decipher, CAST_Encipher, F1, F2, F3, init, IntsTo32bits, processBlock
-
Field Details
-
ROUNDS
protected static final int ROUNDS- See Also:
-
BLOCK_SIZE
protected static final int BLOCK_SIZE- See Also:
-
_Kr
protected int[] _Kr -
_Km
protected int[] _Km -
_Tr
protected int[] _Tr -
_Tm
protected int[] _Tm
-
-
Constructor Details
-
CAST6Engine
public CAST6Engine()
-
-
Method Details
-
getAlgorithmName
Description copied from interface:BlockCipherReturn the name of the algorithm the cipher implements.- Specified by:
getAlgorithmNamein interfaceBlockCipher- Overrides:
getAlgorithmNamein classCAST5Engine- Returns:
- the name of the algorithm the cipher implements.
-
reset
public void reset()Description copied from interface:BlockCipherReset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).- Specified by:
resetin interfaceBlockCipher- Overrides:
resetin classCAST5Engine
-
getBlockSize
public int getBlockSize()Description copied from interface:BlockCipherReturn the block size for this cipher (in bytes).- Specified by:
getBlockSizein interfaceBlockCipher- Overrides:
getBlockSizein classCAST5Engine- Returns:
- the block size for this cipher in bytes.
-
setKey
protected void setKey(byte[] key) - Overrides:
setKeyin classCAST5Engine
-
encryptBlock
protected int encryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) Encrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.- Overrides:
encryptBlockin classCAST5Engine- Parameters:
src- The plaintext buffersrcIndex- An offset into srcdst- The ciphertext bufferdstIndex- An offset into dst
-
decryptBlock
protected int decryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) Decrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.- Overrides:
decryptBlockin classCAST5Engine- Parameters:
src- The plaintext buffersrcIndex- An offset into srcdst- The ciphertext bufferdstIndex- An offset into dst
-
CAST_Encipher
protected final void CAST_Encipher(int A, int B, int C, int D, int[] result) Does the 12 quad rounds rounds to encrypt the block.- Parameters:
A- the 00-31 bits of the plaintext blockB- the 32-63 bits of the plaintext blockC- the 64-95 bits of the plaintext blockD- the 96-127 bits of the plaintext blockresult- the resulting ciphertext
-
CAST_Decipher
protected final void CAST_Decipher(int A, int B, int C, int D, int[] result) Does the 12 quad rounds rounds to decrypt the block.- Parameters:
A- the 00-31 bits of the ciphertext blockB- the 32-63 bits of the ciphertext blockC- the 64-95 bits of the ciphertext blockD- the 96-127 bits of the ciphertext blockresult- the resulting plaintext
-