Raise ArgumentError instead of RuntimeError on bad hash length.
This commit is contained in:
parent
7d79af602b
commit
08e465c128
1 changed files with 2 additions and 2 deletions
|
@ -30,7 +30,7 @@ sha3_init(hashState *ctx, size_t bitlen) {
|
||||||
case FAIL:
|
case FAIL:
|
||||||
rb_raise(rb_eRuntimeError, "Unknown error");
|
rb_raise(rb_eRuntimeError, "Unknown error");
|
||||||
case BAD_HASHLEN:
|
case BAD_HASHLEN:
|
||||||
rb_raise(rb_eRuntimeError, "Bad hash length (must be 0, 224, 256, 384 or 512)");
|
rb_raise(rb_eArgError, "Bad hash length (must be 0, 224, 256, 384 or 512)");
|
||||||
default:
|
default:
|
||||||
rb_raise(rb_eRuntimeError, "Unknown error code");
|
rb_raise(rb_eRuntimeError, "Unknown error code");
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ rb_sha3_initialize(int argc, VALUE *argv, VALUE self) {
|
||||||
}
|
}
|
||||||
switch (i_hashlen) {
|
switch (i_hashlen) {
|
||||||
case 0:
|
case 0:
|
||||||
rb_raise(rb_eRuntimeError, "Unsupported hash length");
|
rb_raise(rb_eArgError, "Unsupported hash length");
|
||||||
case DEFAULT_DIGEST_LEN:
|
case DEFAULT_DIGEST_LEN:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue