| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private boolean | |
| private int[] | |
| private int[] | |
| private byte[] | |
| private int | |
| private static final int | STATE_SIZE
Constants |
| private byte[] | |
| private byte[] | workingKey
Variables to hold the state of the engine during encryption and decryption |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | getAlgorithmName()
Implements org. Return the name of the algorithm the cipher implements. |
| private byte | |
| private int | |
| private int | |
| private int | |
| public void | init(boolean
Whether or not we are for encryption. forEncryption, CipherParameters The parameters required to set up the cipher. params)Implements org. Initialize a Grain v1 cipher. |
| private void | |
| private void | |
| public int | processBytes(byte[]
the input byte array. in, int the offset into the in array where the data to be processed starts. inOff, int the number of bytes to be processed. len, byte[] the output buffer the processed bytes go into. out, int the offset into the output byte array the processed data starts at. outOff)Implements org. process a block of bytes from in putting the result into out. |
| public void | |
| public byte | returnByte(byte
the byte to be processed. in)Implements org. encrypt/decrypt a single byte returning the result. |
| private void | |
| private int[] | Returns: The shifted array with val added to index.length - 1.The array to shift. array, int The value to shift in. val)Shift array 16 bits and add val to index.length - 1. |
| index | back to summary |
|---|---|
| private int index | |
| initialised | back to summary |
|---|---|
| private boolean initialised | |
| lfsr | back to summary |
|---|---|
| private int[] lfsr | |
| nfsr | back to summary |
|---|---|
| private int[] nfsr | |
| out | back to summary |
|---|---|
| private byte[] out | |
| output | back to summary |
|---|---|
| private int output | |
| STATE_SIZE | back to summary |
|---|---|
| private static final int STATE_SIZE Constants | |
| workingIV | back to summary |
|---|---|
| private byte[] workingIV | |
| workingKey | back to summary |
|---|---|
| private byte[] workingKey Variables to hold the state of the engine during encryption and decryption | |
| Grainv1Engine | back to summary |
|---|---|
| public Grainv1Engine() | |
| getAlgorithmName | back to summary |
|---|---|
| public String getAlgorithmName() Implements org. Doc from org. Return the name of the algorithm the cipher implements.
| |
| getKeyStream | back to summary |
|---|---|
| private byte getKeyStream() | |
| getOutput | back to summary |
|---|---|
| private int getOutput() Get output from output function h(x).
| |
| getOutputLFSR | back to summary |
|---|---|
| private int getOutputLFSR() Get output from linear function f(x).
| |
| getOutputNFSR | back to summary |
|---|---|
| private int getOutputNFSR() Get output from non-linear function g(x).
| |
| init | back to summary |
|---|---|
| public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException Implements org. Initialize a Grain v1 cipher.
| |
| initGrain | back to summary |
|---|---|
| private void initGrain() 160 clocks initialization phase. | |
| oneRound | back to summary |
|---|---|
| private void oneRound() Run Grain one round(i.e. 16 bits). | |
| processBytes | back to summary |
|---|---|
| public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException Implements org. Doc from org. process a block of bytes from in putting the result into out.
| |
| reset | back to summary |
|---|---|
| public void reset() Implements org. Doc from org. reset the cipher. This leaves it in the same state it was at after the last init (if there was one). | |
| returnByte | back to summary |
|---|---|
| public byte returnByte(byte in) Implements org. Doc from org. encrypt/decrypt a single byte returning the result.
| |
| setKey | back to summary |
|---|---|
| private void setKey(byte[] keyBytes, byte[] ivBytes) Set keys, reset cipher.
| |
| shift | back to summary |
|---|---|
| private int[] shift(int[] array, int val) Shift array 16 bits and add val to index.length - 1.
| |