Method: OpenSSL::HMAC#digest
- Defined in:
- ossl_hmac.c
#digest ⇒ String
Returns the authentication code an instance represents as a binary string.
Example
instance = OpenSSL::HMAC.new(‘key’, OpenSSL::Digest.new(‘sha1’)) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.digest #=> “xF4+xB0xEExB0x18xEBxBDEx97xAErx13qx1ExC6a‘x84?”
190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'ossl_hmac.c', line 190
static VALUE
ossl_hmac_digest(VALUE self)
{
HMAC_CTX *ctx;
unsigned char *buf;
unsigned int buf_len;
VALUE digest;
GetHMAC(self, ctx);
hmac_final(ctx, &buf, &buf_len);
digest = ossl_buf2str((char *)buf, buf_len);
return digest;
}
|