org.bouncycastle.crypto.engines
Class CAST6Engine
- BlockCipher
public final class CAST6Engine
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.
BLOCK_SIZE , M32 , MAX_ROUNDS , RED_ROUNDS , S1 , S2 , S3 , S4 , S5 , S6 , S7 , S8 , _Km , _Kr |
protected void | CAST_Decipher(int A, int B, int C, int D, result[] ) - Does the 12 quad rounds rounds to decrypt the block.
|
protected void | CAST_Encipher(int A, int B, int C, int D, result[] ) - Does the 12 quad rounds rounds to encrypt the block.
|
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.
|
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.
|
String | getAlgorithmName() - Return the name of the algorithm the cipher implements.
|
int | getBlockSize() - Return the block size for this cipher (in bytes).
|
void | reset() - Reset the cipher.
|
protected void | setKey(byte[] key)
|
Bits32ToBytes , Bits32ToInts , BytesTo32bits , CAST_Decipher , CAST_Encipher , F1 , F2 , F3 , IntsTo32bits , decryptBlock , encryptBlock , getAlgorithmName , getBlockSize , init , processBlock , reset , setKey |
BLOCK_SIZE
protected static final int BLOCK_SIZE
- 16
ROUNDS
protected static final int ROUNDS
- 12
CAST6Engine
public CAST6Engine()
CAST_Decipher
protected final void CAST_Decipher(int A,
int B,
int C,
int D,
result[] )
Does the 12 quad rounds rounds to decrypt the block.
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 block
CAST_Encipher
protected final void CAST_Encipher(int A,
int B,
int C,
int D,
result[] )
Does the 12 quad rounds rounds to encrypt the block.
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 block
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.
- decryptBlock in interface CAST5Engine
src
- The plaintext buffersrcIndex
- An offset into srcdst
- The ciphertext bufferdstIndex
- An offset into dst
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.
- encryptBlock in interface CAST5Engine
src
- The plaintext buffersrcIndex
- An offset into srcdst
- The ciphertext bufferdstIndex
- An offset into dst
getAlgorithmName
public String getAlgorithmName()
Return the name of the algorithm the cipher implements.
- getAlgorithmName in interface BlockCipher
- getAlgorithmName in interface CAST5Engine
- the name of the algorithm the cipher implements.
getBlockSize
public int getBlockSize()
Return the block size for this cipher (in bytes).
- getBlockSize in interface BlockCipher
- getBlockSize in interface CAST5Engine
- the block size for this cipher in bytes.
reset
public void reset()
Reset the cipher. After resetting the cipher is in the same state
as it was after the last init (if there was one).
- reset in interface BlockCipher
- reset in interface CAST5Engine
setKey
protected void setKey(byte[] key)
- setKey in interface CAST5Engine