RC2ParameterSpecpublic class RC2ParameterSpec extends Object implements AlgorithmParameterSpecThe algorithm parameter specification for the RC2 algorithm. |
Fields Summary |
---|
private final int | effectiveKeyBits | private final byte[] | iv |
Constructors Summary |
---|
public RC2ParameterSpec(int effectiveKeyBits)Creates a new RC2ParameterSpec instance with the specified
effective key length (in bits),
this.effectiveKeyBits = effectiveKeyBits;
iv = null;
| public RC2ParameterSpec(int effectiveKeyBits, byte[] iv)Creates a new RC2ParameterSpec instance with the specified
effective key length (in bits) and initialization vector.
The size of the initialization vector must be at least 8 bytes
which are copied to protect them against modification.
if (iv == null) {
throw new IllegalArgumentException(Messages.getString("crypto.31")); //$NON-NLS-1$
}
if (iv.length < 8) {
throw new IllegalArgumentException(Messages.getString("crypto.41")); //$NON-NLS-1$
}
this.effectiveKeyBits = effectiveKeyBits;
this.iv = new byte[8];
System.arraycopy(iv, 0, this.iv, 0, 8);
| public RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset)Creates a new RC2ParameterSpec instance with the specified
effective key length (in bits) and initialization vector.
The size of the initialization vector starting at
offset must be at least 8 bytes which are copied to protect
them against modification.
if (iv == null) {
throw new IllegalArgumentException(Messages.getString("crypto.31")); //$NON-NLS-1$
}
if (iv.length - offset < 8) {
throw new IllegalArgumentException(Messages.getString("crypto.41")); //$NON-NLS-1$
}
this.effectiveKeyBits = effectiveKeyBits;
this.iv = new byte[8];
System.arraycopy(iv, offset, this.iv, 0, 8);
|
Methods Summary |
---|
public boolean | equals(java.lang.Object obj)Compares the specified object to this RC2ParameterSpec
instance.
if (obj == this) {
return true;
}
if (!(obj instanceof RC2ParameterSpec)) {
return false;
}
RC2ParameterSpec ps = (RC2ParameterSpec) obj;
return (effectiveKeyBits == ps.effectiveKeyBits)
&& (Arrays.equals(iv, ps.iv));
| public int | getEffectiveKeyBits()Returns the effective key length (in bits).
return effectiveKeyBits;
| public byte[] | getIV()Returns a copy of the initialization vector.
if (iv == null) {
return null;
}
byte[] result = new byte[iv.length];
System.arraycopy(iv, 0, result, 0, iv.length);
return result;
| public int | hashCode()Returns the hash code of this RC2ParameterSpec instance.
int result = effectiveKeyBits;
if (iv == null) {
return result;
}
for (byte element : iv) {
result += element;
}
return result;
|
|