public class CAST5Engine extends Object implements BlockCipher
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
_Km |
protected int[] |
_Kr |
protected static int |
BLOCK_SIZE |
protected static int |
M32 |
protected static int |
MAX_ROUNDS |
protected static int |
RED_ROUNDS |
protected static int[] |
S1 |
protected static int[] |
S2 |
protected static int[] |
S3 |
protected static int[] |
S4 |
protected static int[] |
S5 |
protected static int[] |
S6 |
protected static int[] |
S7 |
protected static int[] |
S8 |
| Constructor and Description |
|---|
CAST5Engine() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
Bits32ToBytes(int in,
byte[] b,
int offset) |
protected void |
Bits32ToInts(int in,
int[] b,
int offset) |
protected int |
BytesTo32bits(byte[] b,
int i) |
protected void |
CAST_Decipher(int L16,
int R16,
int[] result) |
protected void |
CAST_Encipher(int L0,
int R0,
int[] result)
Does the 16 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.
|
protected int |
F1(int D,
int Kmi,
int Kri)
The first of the three processing functions for the
encryption and decryption.
|
protected int |
F2(int D,
int Kmi,
int Kri)
The second of the three processing functions for the
encryption and decryption.
|
protected int |
F3(int D,
int Kmi,
int Kri)
The third of the three processing functions for the
encryption and decryption.
|
String |
getAlgorithmName()
Return the name of the algorithm the cipher implements.
|
int |
getBlockSize()
Return the block size for this cipher (in bytes).
|
void |
init(boolean encrypting,
CipherParameters params)
initialise a CAST cipher.
|
protected int |
IntsTo32bits(int[] b,
int i) |
int |
processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
Process one block of input from the array in and write it to
the out array.
|
void |
reset()
Reset the cipher.
|
protected void |
setKey(byte[] key) |
protected static final int M32
protected static final int[] S1
protected static final int[] S2
protected static final int[] S3
protected static final int[] S4
protected static final int[] S5
protected static final int[] S6
protected static final int[] S7
protected static final int[] S8
protected static final int MAX_ROUNDS
protected static final int RED_ROUNDS
protected static final int BLOCK_SIZE
protected int[] _Kr
protected int[] _Km
public void init(boolean encrypting,
CipherParameters params)
init in interface BlockCipherencrypting - whether or not we are for encryption.params - the parameters required to set up the cipher.IllegalArgumentException - if the params argument is
inappropriate.public String getAlgorithmName()
BlockCiphergetAlgorithmName in interface BlockCipherpublic int processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
BlockCipherprocessBlock in interface BlockCipherin - the array containing the input data.inOff - offset into the in array the data starts at.out - the array the output data will be copied into.outOff - the offset into the out array the output will start at.public void reset()
BlockCipherreset in interface BlockCipherpublic int getBlockSize()
BlockCiphergetBlockSize in interface BlockCipherprotected void setKey(byte[] key)
protected int encryptBlock(byte[] src,
int srcIndex,
byte[] dst,
int dstIndex)
src - The plaintext buffersrcIndex - An offset into srcdst - The ciphertext bufferdstIndex - An offset into dstprotected int decryptBlock(byte[] src,
int srcIndex,
byte[] dst,
int dstIndex)
src - The plaintext buffersrcIndex - An offset into srcdst - The ciphertext bufferdstIndex - An offset into dstprotected final int F1(int D,
int Kmi,
int Kri)
D - the input to be processedKmi - the mask to be used from Km[n]Kri - the rotation value to be usedprotected final int F2(int D,
int Kmi,
int Kri)
D - the input to be processedKmi - the mask to be used from Km[n]Kri - the rotation value to be usedprotected final int F3(int D,
int Kmi,
int Kri)
D - the input to be processedKmi - the mask to be used from Km[n]Kri - the rotation value to be usedprotected final void CAST_Encipher(int L0,
int R0,
int[] result)
L0 - the LH-32bits of the plaintext blockR0 - the RH-32bits of the plaintext blockprotected final void CAST_Decipher(int L16,
int R16,
int[] result)
protected final void Bits32ToInts(int in,
int[] b,
int offset)
protected final int IntsTo32bits(int[] b,
int i)
protected final void Bits32ToBytes(int in,
byte[] b,
int offset)
protected final int BytesTo32bits(byte[] b,
int i)
Copyright © 2015. All rights reserved.