* Hash: Throw IAE if data length is not 32 bytes,

now that DSAEngine abuse is gone
This commit is contained in:
zzz
2010-10-02 15:00:30 +00:00
parent ed4c09b456
commit 4a96e88118

View File

@ -31,6 +31,7 @@ public class Hash extends DataStructureImpl {
public Hash() {
}
/** @throws IllegalArgumentException if data is not 32 bytes (null is ok) */
public Hash(byte data[]) {
setData(data);
}
@ -39,7 +40,10 @@ public class Hash extends DataStructureImpl {
return _data;
}
/** @throws IllegalArgumentException if data is not 32 bytes (null is ok) */
public void setData(byte[] data) {
if (data != null && data.length != HASH_LENGTH)
throw new IllegalArgumentException("Hash must be 32 bytes");
_data = data;
_stringified = null;
_base64ed = null;