gi-glib-2.0.24: GLib bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.GLib.Structs.Hmac

Contents

- Exported types
- Methods
  - Overloaded methods
  - getDigest
  - getString
  - unref
  - update

Description

An opaque structure representing a HMAC operation. To create a new GHmac, use `g_hmac_new()`. To free a GHmac, use `hmacUnref`.

Since: 2.30

Synopsis

- newtype Hmac = Hmac (ManagedPtr Hmac)
- hmacGetDigest :: (HasCallStack, MonadIO m) => Hmac -> ByteString -> m ()
- hmacGetString :: (HasCallStack, MonadIO m) => Hmac -> m Text
- hmacUnref :: (HasCallStack, MonadIO m) => Hmac -> m ()
- hmacUpdate :: (HasCallStack, MonadIO m) => Hmac -> ByteString -> m ()

# Exported types

newtype Hmac Source #

Memory-managed wrapper type.

Constructors

Hmac (ManagedPtr Hmac) |

#### Instances

Instances details

Eq Hmac Source # |
Instance details Defined in GI.GLib.Structs.Hmac Methods (==) :: Hmac -> Hmac -> Bool # (/=) :: Hmac -> Hmac -> Bool #
ManagedPtrNewtype Hmac Source # |
Instance details Defined in GI.GLib.Structs.Hmac Methods toManagedPtr :: Hmac -> ManagedPtr Hmac Source #
BoxedPtr Hmac Source # |
Instance details Defined in GI.GLib.Structs.Hmac Methods boxedPtrCopy :: Hmac -> IO Hmac Source # boxedPtrFree :: Hmac -> IO () Source #

# Methods

## Overloaded methods

## getDigest

hmacGetDigest Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Hmac | `hmac`: a `Hmac`
-> ByteString | `buffer`: output buffer
-> m () |

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.

Once this function has been called, the `Hmac` is closed and can no longer be updated with `checksumUpdate`.

Since: 2.30

## getString

hmacGetString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Hmac | `hmac`: a `Hmac`
-> m Text | Returns: the hexadecimal representation of the HMAC. The returned string is owned by the HMAC and should not be modified or freed.

Gets the HMAC as a hexadecimal string.

Once this function has been called the `Hmac` can no longer be updated with `hmacUpdate`.

The hexadecimal characters will be lower case.

Since: 2.30

## unref

hmacUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Hmac | `hmac`: a `Hmac`
-> m () |

Atomically decrements the reference count of `hmac` by one.

If the reference count drops to 0, all keys and values will be destroyed, and all memory allocated by the hash table is released. This function is MT-safe and may be called from any thread. Frees the memory allocated for `hmac`.

Since: 2.30

## update

hmacUpdate Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Hmac | `hmac`: a `Hmac`
-> ByteString | `data`: buffer used to compute the checksum
-> m () |

Feeds `data` into an existing `Hmac`.

The HMAC must still be open, that is `hmacGetString` or `hmacGetDigest` must not have been called on `hmac`.

Since: 2.30