de.flexiprovider.core.rc5
Class RC5ParameterSpec

java.lang.Object
  |
  +--de.flexiprovider.core.rc5.RC5ParameterSpec
All Implemented Interfaces:
AlgorithmParameterSpec, java.security.spec.AlgorithmParameterSpec

public class RC5ParameterSpec
extends java.lang.Object
implements AlgorithmParameterSpec

This class specifies the parameters for the RC5 Algorithm. The parameters consist of the version number, the number of rounds, the word size, and an optional initialization vector (IV). The block size of RC5 is twice the word size. Values for the number of rounds are 8 to 127, with the default being 12. Values for the word size are 16, 32, and 64 bits, with the default being 32 bits.

Author:
Oliver Seiler, Martin Döring

Field Summary
static int DEFAULT_NUM_ROUNDS
          The default number of rounds (12)
static int DEFAULT_WORD_SIZE
          The default word size (32 bits)
static int RC5_v1_0
          Constant defining the first version of RC5
 
Constructor Summary
RC5ParameterSpec()
          Construct the default RC5 parameters without an IV.
RC5ParameterSpec(int numRounds, int wordSize)
          Construct a parameter set for RC5 from the given number of rounds and word size.
RC5ParameterSpec(int numRounds, int wordSize, ModeParameterSpec modeParams)
          Construct a parameter set for RC5 from the given number of rounds, word size, and initialization vector (IV).
RC5ParameterSpec(ModeParameterSpec modeParams)
          Construct the default RC5 parameters with the given IV.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compare these parameters with another object.
 byte[] getIV()
           
 int getNumRounds()
           
 int getVersion()
           
 int getWordSize()
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RC5_v1_0

public static final int RC5_v1_0
Constant defining the first version of RC5

DEFAULT_NUM_ROUNDS

public static final int DEFAULT_NUM_ROUNDS
The default number of rounds (12)

DEFAULT_WORD_SIZE

public static final int DEFAULT_WORD_SIZE
The default word size (32 bits)
Constructor Detail

RC5ParameterSpec

public RC5ParameterSpec()
Construct the default RC5 parameters without an IV. The default parameters are:

RC5ParameterSpec

public RC5ParameterSpec(ModeParameterSpec modeParams)
Construct the default RC5 parameters with the given IV. The default parameters are:
Parameters:
modeParams - the mode parameters containing the IV

RC5ParameterSpec

public RC5ParameterSpec(int numRounds,
                        int wordSize)
Construct a parameter set for RC5 from the given number of rounds and word size. Choose version as RC5_v1_0. If the number of rounds is invalid, choose DEFAULT_NUM_ROUNDS. If the word size is invalid, choose the DEFAULT_WORD_SIZE. The block size of RC5 is twice the word size.
Parameters:
numRounds - the number of rounds (8...127)
wordSize - the word size (16, 32, or 64 bits)

RC5ParameterSpec

public RC5ParameterSpec(int numRounds,
                        int wordSize,
                        ModeParameterSpec modeParams)
Construct a parameter set for RC5 from the given number of rounds, word size, and initialization vector (IV). Choose version as RC5_v1_0. If the number of rounds is invalid, choose DEFAULT_NUM_ROUNDS. If the word size is invalid, choose the DEFAULT_WORD_SIZE. The block size of RC5 is twice the word size.
Parameters:
numRounds - the number of rounds (8...127)
wordSize - the word size (16, 32, or 64 bits)
modeParams - the mode parameters containing the IV
Method Detail

getVersion

public int getVersion()
Returns:
the version number

getNumRounds

public int getNumRounds()
Returns:
the number of rounds

getWordSize

public int getWordSize()
Returns:
the word size in bits

getIV

public byte[] getIV()
Returns:
a copy of the initialization vector (IV) (maybe null)

equals

public boolean equals(java.lang.Object other)
Compare these parameters with another object.
Overrides:
equals in class java.lang.Object
Parameters:
other - the other object
Returns:
the result of the comparison

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of these parameters