glib.hmac

Module for [Hmac] class

class Hmac

Types 1

HMACs should be used when producing a cookie or hash based on data and a key. Simple mechanisms for using SHA1 and other algorithms to digest a key and data together are vulnerable to various security issues.

HMAC

uses algorithms like SHA1 in a secure way to produce a digest of a key and data.

Both the key and data are arbitrary byte arrays of bytes or characters.

Support for HMAC Digests has been added in GLib 2.30, and support for SHA-512 in GLib 2.42. Support for SHA-384 was added in GLib 2.52.

To create a new [glib.hmac.Hmac], use [glib.hmac.Hmac.new_]. To free a [glib.hmac.Hmac], use [glib.hmac.Hmac.unref].

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
Hmac self()Returns `this`, for use in `with` statements.
glib.hmac.Hmac copy()Copies a #GHmac. If hmac has been closed, by calling [glib.hmac.Hmac.getString] or [glib.hmac.Hmac.getDigest], the copied HMAC will be closed as well. Returns: the copy of the passed #GHmac. Use [g...
void getDigest(ref ubyte[] buffer)Gets the digest from checksum as a raw binary array and places it into buffer. The size of the digest depends on the type of checksum.
string getString()Gets the HMAC as a hexadecimal string.
void update(ubyte[] data)Feeds data into an existing #GHmac.
Constructors
this(void * ptr, Flag!"Take" take)
this(glib.types.ChecksumType digestType, ubyte[] key)Creates a new #GHmac, using the digest algorithm digesttype. If the digesttype is not known, null is returned. A #GHmac can be used to compute the HMAC of a key and an arbitrary binary blob, using ...