public class SEEDEngine extends java.lang.Object implements BlockCipher
Modifier and Type | Field and Description |
---|---|
private int |
BLOCK_SIZE |
private boolean |
forEncryption |
private static int[] |
KC |
private static int[] |
SS0 |
private static int[] |
SS1 |
private static int[] |
SS2 |
private static int[] |
SS3 |
private int[] |
wKey |
Constructor and Description |
---|
SEEDEngine() |
Modifier and Type | Method and Description |
---|---|
private long |
bytesToLong(byte[] src,
int srcOff) |
private int[] |
createWorkingKey(byte[] inKey) |
private int |
extractW0(long lVal) |
private int |
extractW1(long lVal) |
private long |
F(int ki0,
int ki1,
long r) |
private int |
G(int x) |
java.lang.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 forEncryption,
CipherParameters params)
Initialise the cipher.
|
private void |
longToBytes(byte[] dest,
int destOff,
long value) |
private int |
phaseCalc1(int r0,
int ki0,
int r1,
int ki1) |
private int |
phaseCalc2(int r0,
int ki0,
int r1,
int ki1) |
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.
|
private long |
rotateLeft8(long x) |
private long |
rotateRight8(long x) |
private final int BLOCK_SIZE
private static final int[] SS0
private static final int[] SS1
private static final int[] SS2
private static final int[] SS3
private static final int[] KC
private int[] wKey
private boolean forEncryption
public void init(boolean forEncryption, CipherParameters params) throws java.lang.IllegalArgumentException
BlockCipher
init
in interface BlockCipher
forEncryption
- if true the cipher is initialised for
encryption, if false for decryption.params
- the key and other data required by the cipher.java.lang.IllegalArgumentException
- if the params argument is
inappropriate.public java.lang.String getAlgorithmName()
BlockCipher
getAlgorithmName
in interface BlockCipher
public int getBlockSize()
BlockCipher
getBlockSize
in interface BlockCipher
public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, java.lang.IllegalStateException
BlockCipher
processBlock
in interface BlockCipher
in
- 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.DataLengthException
- if there isn't enough data in in, or
space in out.java.lang.IllegalStateException
- if the cipher isn't initialised.public void reset()
BlockCipher
reset
in interface BlockCipher
private int[] createWorkingKey(byte[] inKey)
private int extractW1(long lVal)
private int extractW0(long lVal)
private long rotateLeft8(long x)
private long rotateRight8(long x)
private long bytesToLong(byte[] src, int srcOff)
private void longToBytes(byte[] dest, int destOff, long value)
private int G(int x)
private long F(int ki0, int ki1, long r)
private int phaseCalc1(int r0, int ki0, int r1, int ki1)
private int phaseCalc2(int r0, int ki0, int r1, int ki1)