|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bouncycastle.crypto.engines.SEEDEngine
public class SEEDEngine
Implementation of the SEED algorithm as described in RFC 4009
Field Summary | |
---|---|
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 Summary | |
---|---|
SEEDEngine()
|
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public SEEDEngine()
Method Detail |
---|
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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |