Lyricdev
GitHub

class Hmac

pub class Hmac<D :: [Digest]>

A message authentication code over a digest (RFC 2104): Hmac<Sha256>.new(key), then update and finish as with a digest. Compare the code it returns with constantTimeEq, not ==.

Methods

pub static fn new(key: Slice<uint8>): Hmac<D>

Returns an HMAC keyed with key, fed nothing yet.

pub mut fn update(bytes: Slice<uint8>): void

Feeds bytes to the message.

pub fn finish(): uint8[]

Returns the code of everything fed so far, D.size bytes.