public class TEAEngine extends java.lang.Object implements BlockCipher
Modifier and Type | Field and Description |
---|---|
private int |
_a |
private int |
_b |
private int |
_c |
private int |
_d |
private boolean |
_forEncryption |
private boolean |
_initialised |
private static int |
block_size |
private static int |
d_sum |
private static int |
delta |
private static int |
rounds |
Constructor and Description |
---|
TEAEngine()
Create an instance of the TEA encryption algorithm
and set some defaults
|
Modifier and Type | Method and Description |
---|---|
private int |
bytesToInt(byte[] in,
int inOff) |
private int |
decryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff) |
private int |
encryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff) |
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
|
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 void |
setKey(byte[] key)
Re-key the cipher.
|
private void |
unpackInt(int v,
byte[] out,
int outOff) |
private static final int rounds
private static final int block_size
private static final int delta
private static final int d_sum
private int _a
private int _b
private int _c
private int _d
private boolean _initialised
private boolean _forEncryption
public TEAEngine()
public java.lang.String getAlgorithmName()
BlockCipher
getAlgorithmName
in interface BlockCipher
public int getBlockSize()
BlockCipher
getBlockSize
in interface BlockCipher
public void init(boolean forEncryption, CipherParameters params)
init
in interface BlockCipher
forEncryption
- whether or not we are for encryption.params
- the parameters required to set up the cipher.java.lang.IllegalArgumentException
- if the params argument is
inappropriate.public int processBlock(byte[] in, int inOff, byte[] out, int outOff)
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.public void reset()
BlockCipher
reset
in interface BlockCipher
private void setKey(byte[] key)
key
- the key to be usedprivate int encryptBlock(byte[] in, int inOff, byte[] out, int outOff)
private int decryptBlock(byte[] in, int inOff, byte[] out, int outOff)
private int bytesToInt(byte[] in, int inOff)
private void unpackInt(int v, byte[] out, int outOff)