com.sshtools.cipher
Class CAST5Engine
java.lang.Object
com.sshtools.cipher.CAST5Engine
- All Implemented Interfaces:
- com.maverick.crypto.engines.CipherEngine
- public class CAST5Engine
- extends java.lang.Object
- implements com.maverick.crypto.engines.CipherEngine
A class that provides CAST key encryption operations,
such as encoding data and generating keys.
All the algorithms herein are from the Internet RFC's
RFC2144 - CAST5 (64bit block, 40-128bit key)
RFC2612 - CAST6 (128bit block, 128-256bit key)
and implement a simplified cryptography interface.
Field Summary |
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
|
Method Summary |
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)
|
protected int |
decryptBlock(byte[] src,
int srcIndex,
byte[] dst,
int dstIndex)
|
protected int |
encryptBlock(byte[] src,
int srcIndex,
byte[] dst,
int dstIndex)
|
protected int |
F1(int D,
int Kmi,
int Kri)
|
protected int |
F2(int D,
int Kmi,
int Kri)
|
protected int |
F3(int D,
int Kmi,
int Kri)
|
java.lang.String |
getAlgorithmName()
|
int |
getBlockSize()
|
void |
init(boolean encrypting,
byte[] key)
|
protected int |
IntsTo32bits(int[] b,
int i)
|
int |
processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
|
void |
reset()
|
protected void |
setKey(byte[] key)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
M32
protected static final int M32
- See Also:
- Constant Field Values
S1
protected static final int[] S1
S2
protected static final int[] S2
S3
protected static final int[] S3
S4
protected static final int[] S4
S5
protected static final int[] S5
S6
protected static final int[] S6
S7
protected static final int[] S7
S8
protected static final int[] S8
MAX_ROUNDS
protected static final int MAX_ROUNDS
- See Also:
- Constant Field Values
RED_ROUNDS
protected static final int RED_ROUNDS
- See Also:
- Constant Field Values
BLOCK_SIZE
protected static final int BLOCK_SIZE
- See Also:
- Constant Field Values
_Kr
protected int[] _Kr
_Km
protected int[] _Km
CAST5Engine
public CAST5Engine()
init
public void init(boolean encrypting,
byte[] key)
- Specified by:
init
in interface com.maverick.crypto.engines.CipherEngine
getAlgorithmName
public java.lang.String getAlgorithmName()
processBlock
public int processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
throws java.io.IOException
- Specified by:
processBlock
in interface com.maverick.crypto.engines.CipherEngine
- Throws:
java.io.IOException
reset
public void reset()
getBlockSize
public int getBlockSize()
- Specified by:
getBlockSize
in interface com.maverick.crypto.engines.CipherEngine
setKey
protected void setKey(byte[] key)
encryptBlock
protected int encryptBlock(byte[] src,
int srcIndex,
byte[] dst,
int dstIndex)
decryptBlock
protected int decryptBlock(byte[] src,
int srcIndex,
byte[] dst,
int dstIndex)
F1
protected final int F1(int D,
int Kmi,
int Kri)
F2
protected final int F2(int D,
int Kmi,
int Kri)
F3
protected final int F3(int D,
int Kmi,
int Kri)
CAST_Encipher
protected final void CAST_Encipher(int L0,
int R0,
int[] result)
CAST_Decipher
protected final void CAST_Decipher(int L16,
int R16,
int[] result)
Bits32ToInts
protected final void Bits32ToInts(int in,
int[] b,
int offset)
IntsTo32bits
protected final int IntsTo32bits(int[] b,
int i)
Bits32ToBytes
protected final void Bits32ToBytes(int in,
byte[] b,
int offset)
BytesTo32bits
protected final int BytesTo32bits(byte[] b,
int i)
Copyright © 2003 3SP LTD. All Rights Reserved.