Package javax.crypto.spec
Class RC5ParameterSpec
java.lang.Object
javax.crypto.spec.RC5ParameterSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
public class RC5ParameterSpec extends Object implements AlgorithmParameterSpec
The algorithm parameter specification for the RC5 algorithm.
-
Constructor Summary
Constructors Constructor Description RC5ParameterSpec(int version, int rounds, int wordSize)Creates a newRC5ParameterSpecinstance with the specified version, round count an word size (in bits).RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv)Creates a newRC5ParameterSpecinstance with the specified version, round count, word size (in bits) and an initialization vector.RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv, int offset)Creates a newRC5ParameterSpecinstance with the specified version, round count, wordSize (in bits), an initialization vector and an offset. -
Method Summary
Modifier and Type Method Description booleanequals(Object obj)Compares the specified object with thisRC5ParameterSpecinstance.byte[]getIV()Returns a copy of the initialization vector.intgetRounds()Returns the round count.intgetVersion()Returns the version.intgetWordSize()Returns the word size (in bits).inthashCode()Returns the hash code of thisRC5ParameterSpecinstance.
-
Constructor Details
-
RC5ParameterSpec
public RC5ParameterSpec(int version, int rounds, int wordSize)Creates a newRC5ParameterSpecinstance with the specified version, round count an word size (in bits).- Parameters:
version- the version.rounds- the round count.wordSize- the word size (in bits).
-
RC5ParameterSpec
public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv)Creates a newRC5ParameterSpecinstance with the specified version, round count, word size (in bits) and an initialization vector.The size of the initialization vector must be at least
2 * (wordSize / 8)bytes which are copied to protect them against modification.- Parameters:
version- the version.rounds- the round count.wordSize- the word size (in bits).iv- the initialization vector.- Throws:
IllegalArgumentException- if the initialization vector is null or shorter than2 * (wordSize / 8).
-
RC5ParameterSpec
public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv, int offset)Creates a newRC5ParameterSpecinstance with the specified version, round count, wordSize (in bits), an initialization vector and an offset.The size of the initialization vector must be at least
offset + (2 * (wordSize / 8))bytes. The bytes starting atoffsetare copied to protect them against modification.- Parameters:
version- the version.rounds- the round count.wordSize- the word size (in bits).iv- the initialization vector.offset- the offset in the initialization vector.- Throws:
IllegalArgumentException- if the initialization vector is null of shorter thanoffset + (2 * (wordSize / 8)).ArrayIndexOutOfBoundsException- ifoffsetis negative.
-
-
Method Details
-
getVersion
public int getVersion()Returns the version.- Returns:
- the version.
-
getRounds
public int getRounds()Returns the round count.- Returns:
- the round count.
-
getWordSize
public int getWordSize()Returns the word size (in bits).- Returns:
- the word size (in bits).
-
getIV
public byte[] getIV()Returns a copy of the initialization vector.- Returns:
- a copy of the initialization vector, or null if none specified.
-
equals
Compares the specified object with thisRC5ParameterSpecinstance.- Overrides:
equalsin classObject- Parameters:
obj- the object to compare.- Returns:
- true if version, round count, word size and initializaion vector of both objects are equal, otherwise false.
- See Also:
Object.hashCode()
-
hashCode
public int hashCode()Returns the hash code of thisRC5ParameterSpecinstance.- Overrides:
hashCodein classObject- Returns:
- the hash code.
- See Also:
Object.equals(java.lang.Object)
-