hash()
public
Returns a hash code for this object.
See also Object#hash.
Show source
static VALUE
ossl_bn_hash(VALUE self)
{
BIGNUM *bn;
VALUE tmp, hash;
unsigned char *buf;
int len;
GetBN(self, bn);
len = BN_num_bytes(bn);
buf = ALLOCV(tmp, len);
if (BN_bn2bin(bn, buf) != len) {
ALLOCV_END(tmp);
ossl_raise(eBNError, "BN_bn2bin");
}
hash = ST2FIX(rb_memhash(buf, len));
ALLOCV_END(tmp);
return hash;
}