Hmac

class Hmac(val glibHmacPointer: <Error class: unknown class><<Error class: unknown class>>) : ProxyInstance(source)

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 GHmac, use ctor@GLib.Hmac.new. To free a GHmac, use method@GLib.Hmac.unref.

Skipped during bindings generation

  • method get_digest: In/Out parameter is not supported

  • parameter data: Array parameter of type guint8 is not supported

  • parameter key: Array parameter of type guint8 is not supported

Since

2.30

Constructors

Link copied to clipboard
constructor(glibHmacPointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val glibHmacPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val handle: <Error class: unknown class>

Functions

Link copied to clipboard
open override fun addCleaner(cleaner: <Error class: unknown class>): Boolean

Registers a cleaner to be executed when this proxy object is garbage collected.

Link copied to clipboard
fun copy(): Hmac

Copies a #GHmac. If @hmac has been closed, by calling g_hmac_get_string() or g_hmac_get_digest(), the copied HMAC will be closed as well.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compare two proxy instances for equality. This will compare both the type of the instances, and their memory addresses.

Link copied to clipboard
Link copied to clipboard

Gets the HMAC as a hexadecimal string.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun ref(): Hmac

Atomically increments the reference count of @hmac by one.

Link copied to clipboard
open override fun removeCleaner(cleaner: <Error class: unknown class>): Boolean

Removes a previously registered cleaner from this proxy object.

Link copied to clipboard
fun unref()

Atomically decrements the reference count of @hmac by one.