Skip to content

HmacSha256

[Source]

Compute HMAC using SHA-256 as the hash function, as defined in RFC 2104.

Returns a 32-byte message authentication code.

let mac = HmacSha256("secret-key", "Hello, World!")?

Raises an error when the key is longer than OpenSSL's int can hold, and when OpenSSL could not compute the code.

When it raises, reject. Do not compare a message against a code of your own making: a code you invent is one an attacker can send you.

primitive val HmacSha256

Constructors

create

[Source]

new val create()
: HmacSha256 val^

Returns


Public Functions

apply

[Source]

fun box apply(
  key: ByteSeq,
  data: ByteSeq)
: Array[U8 val] val ?

Parameters

Returns


eq

[Source]

fun box eq(
  that: HmacSha256 val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: HmacSha256 val)
: Bool val

Parameters

Returns