For the latest news and information visit
The GNU Crypto project

gnu.crypto.exp
Class Helix

java.lang.Object
  extended bygnu.crypto.exp.Helix
All Implemented Interfaces:
Cloneable, IBlockCipher, IMac

public class Helix
extends Object
implements IBlockCipher, IMac

The Helix stream cipher and message authentication code. Helix combines a word-aligned stream cipher with a message authentication code in a single cryptographic primitive.

References:

  1. Niels Ferguson, Doug Whiting, Bruce Schneier, John Kelsey, Stefan Lucks, and Tadayoshi Kohno. "Helix: Fast Encryption and Authentication in a Single Cryptographic Primitive". http://www.macfergus.com/helix/helix.pdf


Field Summary
static int DECRYPTION
          The state constant for decryption and optional MAC.
static int ENCRYPTION
          The state constant for encryption and optional MAC.
static int MAC
          The state constant for MAC-only.
static String NONCE
          Property name for the nonce.
static String STATE
          Property name for the state.
 
Fields inherited from interface gnu.crypto.cipher.IBlockCipher
CIPHER_BLOCK_SIZE, KEY_MATERIAL
 
Fields inherited from interface gnu.crypto.mac.IMac
MAC_KEY_MATERIAL, TRUNCATED_SIZE
 
Constructor Summary
Helix()
           
 
Method Summary
 Iterator blockSizes()
          Returns an Iterator over the supported block sizes.
 Object clone()
          Returns a clone of this instance.
 int currentBlockSize()
          Returns the currently set block size for this instance.
 void decryptBlock(byte[] in, int inOff, byte[] out, int outOff)
          Decrypts exactly one block of ciphertext.
 int defaultBlockSize()
          Returns the default value, in bytes, of the algorithm's block size.
 int defaultKeySize()
          Returns the default value, in bytes, of the algorithm's key size.
 byte[] digest()
          Completes the MAC by performing final operations such as padding and resetting the instance.
 void encryptBlock(byte[] in, int inOff, byte[] out, int outOff)
          Encrypts exactly one block of plaintext.
 void init(Map attributes)
          Initialises the algorithm with designated attributes.
 Iterator keySizes()
          Returns an Iterator over the supported key sizes.
 int macSize()
          Returns the output length in bytes of this MAC algorithm.
 String name()
          Returns the canonical name of this instance.
 void reset()
          Resets the algorithm instance for re-initialisation and use with other characteristics.
 boolean selfTest()
          A correctness test that consists of basic symmetric encryption / decryption test(s) for all supported block and key sizes, as well as one (1) variable key Known Answer Test (KAT).
 void update(byte b)
          Continues a MAC operation using the input byte.
 void update(byte[] buf, int off, int len)
          Continues a MAC operation, by filling the buffer, processing data in the algorithm's MAC_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONCE

public static final String NONCE
Property name for the nonce. This parameter is always required and must be a sixteen-byte array.

See Also:
Constant Field Values

STATE

public static final String STATE
Property name for the state. This is an Integer containing one of the constants ENCRYPTION, DECRYPTION, or MAC.

If omitted, ENCRYPTION is assumed.

See Also:
Constant Field Values

ENCRYPTION

public static final int ENCRYPTION
The state constant for encryption and optional MAC.

See Also:
Constant Field Values

DECRYPTION

public static final int DECRYPTION
The state constant for decryption and optional MAC.

See Also:
Constant Field Values

MAC

public static final int MAC
The state constant for MAC-only.

See Also:
Constant Field Values
Constructor Detail

Helix

public Helix()
Method Detail

name

public String name()
Description copied from interface: IBlockCipher

Returns the canonical name of this instance.

Specified by:
name in interface IBlockCipher
Returns:
the canonical name of this instance.

defaultBlockSize

public int defaultBlockSize()
Description copied from interface: IBlockCipher

Returns the default value, in bytes, of the algorithm's block size.

Specified by:
defaultBlockSize in interface IBlockCipher
Returns:
the default value, in bytes, of the algorithm's block size.

defaultKeySize

public int defaultKeySize()
Description copied from interface: IBlockCipher

Returns the default value, in bytes, of the algorithm's key size.

Specified by:
defaultKeySize in interface IBlockCipher
Returns:
the default value, in bytes, of the algorithm's key size.

blockSizes

public Iterator blockSizes()
Description copied from interface: IBlockCipher

Returns an Iterator over the supported block sizes. Each element returned by this object is an Integer.

Specified by:
blockSizes in interface IBlockCipher
Returns:
an Iterator over the supported block sizes.

keySizes

public Iterator keySizes()
Description copied from interface: IBlockCipher

Returns an Iterator over the supported key sizes. Each element returned by this object is an Integer.

Specified by:
keySizes in interface IBlockCipher
Returns:
an Iterator over the supported key sizes.

macSize

public int macSize()
Description copied from interface: IMac

Returns the output length in bytes of this MAC algorithm.

Specified by:
macSize in interface IMac
Returns:
the output length in bytes of this MAC algorithm.

currentBlockSize

public int currentBlockSize()
Description copied from interface: IBlockCipher

Returns the currently set block size for this instance.

Specified by:
currentBlockSize in interface IBlockCipher
Returns:
the current block size for this instance.

clone

public Object clone()
Description copied from interface: IBlockCipher

Returns a clone of this instance.

Specified by:
clone in interface IBlockCipher

reset

public void reset()
Description copied from interface: IBlockCipher

Resets the algorithm instance for re-initialisation and use with other characteristics. This method always succeeds.

Specified by:
reset in interface IBlockCipher

init

public void init(Map attributes)
          throws InvalidKeyException
Description copied from interface: IBlockCipher

Initialises the algorithm with designated attributes. Permissible names and values are described in the class documentation above.

Specified by:
init in interface IBlockCipher
Parameters:
attributes - a set of name-value pairs that describes the desired future behaviour of this instance.
Throws:
InvalidKeyException - if the key data is invalid.
See Also:
IBlockCipher.KEY_MATERIAL, IBlockCipher.CIPHER_BLOCK_SIZE

encryptBlock

public void encryptBlock(byte[] in,
                         int inOff,
                         byte[] out,
                         int outOff)
Description copied from interface: IBlockCipher

Encrypts exactly one block of plaintext.

Specified by:
encryptBlock in interface IBlockCipher
Parameters:
in - the plaintext.
inOff - index of in from which to start considering data.
out - the ciphertext.
outOff - index of out from which to store result.

decryptBlock

public void decryptBlock(byte[] in,
                         int inOff,
                         byte[] out,
                         int outOff)
Description copied from interface: IBlockCipher

Decrypts exactly one block of ciphertext.

Specified by:
decryptBlock in interface IBlockCipher
Parameters:
in - the plaintext.
inOff - index of in from which to start considering data.
out - the ciphertext.
outOff - index of out from which to store result.

update

public void update(byte b)
Description copied from interface: IMac

Continues a MAC operation using the input byte.

Specified by:
update in interface IMac
Parameters:
b - the input byte to digest.

update

public void update(byte[] buf,
                   int off,
                   int len)
Description copied from interface: IMac

Continues a MAC operation, by filling the buffer, processing data in the algorithm's MAC_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation.

Specified by:
update in interface IMac
Parameters:
buf - the input block.
off - start of meaningful bytes in input block.
len - number of bytes, in input block, to consider.

digest

public byte[] digest()
Description copied from interface: IMac

Completes the MAC by performing final operations such as padding and resetting the instance.

Specified by:
digest in interface IMac
Returns:
the array of bytes representing the MAC value.

selfTest

public boolean selfTest()
Description copied from interface: IBlockCipher

A correctness test that consists of basic symmetric encryption / decryption test(s) for all supported block and key sizes, as well as one (1) variable key Known Answer Test (KAT).

Specified by:
selfTest in interface IBlockCipher
Returns:
true if the implementation passes simple correctness tests. Returns false otherwise.

For the latest news and information visit
The GNU Crypto project

Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.