org.bouncycastle.crypto.engines
Class NoekeonEngine

java.lang.Object
  extended by org.bouncycastle.crypto.engines.NoekeonEngine
All Implemented Interfaces:
BlockCipher

public class NoekeonEngine
extends java.lang.Object
implements BlockCipher

A Noekeon engine, using direct-key mode.


Field Summary
private  boolean _forEncryption
           
private  boolean _initialised
           
private  int[] decryptKeys
           
private static int genericSize
           
private static int[] nullVector
           
private static int[] roundConstants
           
private  int[] state
           
private  int[] subKeys
           
 
Constructor Summary
NoekeonEngine()
          Create an instance of the Noekeon encryption algorithm and set some defaults
 
Method Summary
private  int bytesToIntBig(byte[] in, int off)
           
private  int decryptBlock(byte[] in, int inOff, byte[] out, int outOff)
           
private  int encryptBlock(byte[] in, int inOff, byte[] out, int outOff)
           
private  void gamma(int[] a)
           
 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
private  void intToBytesBig(int x, byte[] out, int off)
           
private  void pi1(int[] a)
           
private  void pi2(int[] a)
           
 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  int rotl(int x, int y)
           
private  void setKey(byte[] key)
          Re-key the cipher.
private  void theta(int[] a, int[] k)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

genericSize

private static final int genericSize
See Also:
Constant Field Values

nullVector

private static final int[] nullVector

roundConstants

private static final int[] roundConstants

state

private int[] state

subKeys

private int[] subKeys

decryptKeys

private int[] decryptKeys

_initialised

private boolean _initialised

_forEncryption

private boolean _forEncryption
Constructor Detail

NoekeonEngine

public NoekeonEngine()
Create an instance of the Noekeon encryption algorithm and set some defaults

Method Detail

getAlgorithmName

public java.lang.String getAlgorithmName()
Description copied from interface: BlockCipher
Return the name of the algorithm the cipher implements.

Specified by:
getAlgorithmName in interface BlockCipher
Returns:
the name of the algorithm the cipher implements.

getBlockSize

public int getBlockSize()
Description copied from interface: BlockCipher
Return the block size for this cipher (in bytes).

Specified by:
getBlockSize in interface BlockCipher
Returns:
the block size for this cipher in bytes.

init

public void init(boolean forEncryption,
                 CipherParameters params)
initialise

Specified by:
init in interface BlockCipher
Parameters:
forEncryption - whether or not we are for encryption.
params - the parameters required to set up the cipher.
Throws:
java.lang.IllegalArgumentException - if the params argument is inappropriate.

processBlock

public int processBlock(byte[] in,
                        int inOff,
                        byte[] out,
                        int outOff)
Description copied from interface: BlockCipher
Process one block of input from the array in and write it to the out array.

Specified by:
processBlock in interface BlockCipher
Parameters:
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.
Returns:
the number of bytes processed and produced.

reset

public void reset()
Description copied from interface: BlockCipher
Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).

Specified by:
reset in interface BlockCipher

setKey

private void setKey(byte[] key)
Re-key the cipher.

Parameters:
key - the key to be used

encryptBlock

private int encryptBlock(byte[] in,
                         int inOff,
                         byte[] out,
                         int outOff)

decryptBlock

private int decryptBlock(byte[] in,
                         int inOff,
                         byte[] out,
                         int outOff)

gamma

private void gamma(int[] a)

theta

private void theta(int[] a,
                   int[] k)

pi1

private void pi1(int[] a)

pi2

private void pi2(int[] a)

bytesToIntBig

private int bytesToIntBig(byte[] in,
                          int off)

intToBytesBig

private void intToBytesBig(int x,
                           byte[] out,
                           int off)

rotl

private int rotl(int x,
                 int y)