public class CamelliaLightEngine extends java.lang.Object implements BlockCipher
Modifier and Type | Field and Description |
---|---|
private boolean |
_keyis128 |
private static int |
BLOCK_SIZE |
private boolean |
initialized |
private int[] |
ke |
private int[] |
kw |
private static int |
MASK8 |
private static byte[] |
SBOX1 |
private static int[] |
SIGMA |
private int[] |
state |
private int[] |
subkey |
Constructor and Description |
---|
CamelliaLightEngine() |
Modifier and Type | Method and Description |
---|---|
private int |
bytes2int(byte[] src,
int offset) |
private void |
camelliaF2(int[] s,
int[] skey,
int keyoff) |
private void |
camelliaFLs(int[] s,
int[] fkey,
int keyoff) |
private static void |
decroldq(int rot,
int[] ki,
int ioff,
int[] ko,
int ooff) |
private static void |
decroldqo32(int rot,
int[] ki,
int ioff,
int[] ko,
int ooff) |
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 |
int2bytes(int word,
byte[] dst,
int offset) |
private static int |
leftRotate(int x,
int s) |
private byte |
lRot8(byte v,
int rot) |
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.
|
private int |
processBlock128(byte[] in,
int inOff,
byte[] out,
int outOff) |
private int |
processBlock192or256(byte[] in,
int inOff,
byte[] out,
int outOff) |
void |
reset()
Reset the cipher.
|
private static int |
rightRotate(int x,
int s) |
private static void |
roldq(int rot,
int[] ki,
int ioff,
int[] ko,
int ooff) |
private static void |
roldqo32(int rot,
int[] ki,
int ioff,
int[] ko,
int ooff) |
private int |
sbox2(int x) |
private int |
sbox3(int x) |
private int |
sbox4(int x) |
private void |
setKey(boolean forEncryption,
byte[] key) |
private static final int BLOCK_SIZE
private static final int MASK8
private boolean initialized
private boolean _keyis128
private int[] subkey
private int[] kw
private int[] ke
private int[] state
private static final int[] SIGMA
private static final byte[] SBOX1
private static int rightRotate(int x, int s)
private static int leftRotate(int x, int s)
private static void roldq(int rot, int[] ki, int ioff, int[] ko, int ooff)
private static void decroldq(int rot, int[] ki, int ioff, int[] ko, int ooff)
private static void roldqo32(int rot, int[] ki, int ioff, int[] ko, int ooff)
private static void decroldqo32(int rot, int[] ki, int ioff, int[] ko, int ooff)
private int bytes2int(byte[] src, int offset)
private void int2bytes(int word, byte[] dst, int offset)
private byte lRot8(byte v, int rot)
private int sbox2(int x)
private int sbox3(int x)
private int sbox4(int x)
private void camelliaF2(int[] s, int[] skey, int keyoff)
private void camelliaFLs(int[] s, int[] fkey, int keyoff)
private void setKey(boolean forEncryption, byte[] key)
private int processBlock128(byte[] in, int inOff, byte[] out, int outOff)
private int processBlock192or256(byte[] in, int inOff, byte[] out, int outOff)
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)
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.public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws 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.java.lang.IllegalStateException
- if the cipher isn't initialised.public void reset()
BlockCipher
reset
in interface BlockCipher