Hmac.this

this(void * ptr, Flag!"Take" take)
No documentation available for this declaration.
this(glib.types.ChecksumType digestType, ubyte[] key)

Creates a new #GHmac, using the digest algorithm digest_type. If the digest_type is not known, null is returned. A #GHmac can be used to compute the HMAC of a key and an arbitrary binary blob, using different hashing algorithms.

A #GHmac works by feeding a binary blob through glib.hmac.Hmac.update until the data is complete; the digest can then be extracted using glib.hmac.Hmac.getString, which will return the checksum as a hexadecimal string; or glib.hmac.Hmac.getDigest, which will return a array of raw bytes. Once either glib.hmac.Hmac.getString or glib.hmac.Hmac.getDigest have been called on a #GHmac, the HMAC will be closed and it won't be possible to call glib.hmac.Hmac.update on it anymore.

Support for digests of type G_CHECKSUM_SHA512 has been added in GLib 2.42. Support for G_CHECKSUM_SHA384 was added in GLib 2.52.

Parameters

digestTypethe desired type of digest
keythe key for the HMAC

Returns

the newly created #GHmac, or null.

Use glib.hmac.Hmac.unref to free the memory allocated by it.