gi-glib-2.0.23: GLib bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GLib.Structs.Checksum

Contents

Description

An opaque structure representing a checksumming operation. To create a new GChecksum, use checksumNew. To free a GChecksum, use checksumFree.

Since: 2.16

Synopsis

Exported types

newtype Checksum Source #

Memory-managed wrapper type.

Constructors

Checksum (ManagedPtr Checksum) 
Instances
Eq Checksum Source # 
Instance details

Defined in GI.GLib.Structs.Checksum

Methods

(==) :: Checksum -> Checksum -> Bool

(/=) :: Checksum -> Checksum -> Bool

BoxedObject Checksum Source # 
Instance details

Defined in GI.GLib.Structs.Checksum

Methods

boxedType :: Checksum -> IO GType

IsGValue Checksum Source #

Convert Checksum to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.GLib.Structs.Checksum

Methods

toGValue :: Checksum -> IO GValue

fromGValue :: GValue -> IO Checksum

noChecksum :: Maybe Checksum Source #

A convenience alias for Nothing :: Maybe Checksum.

Methods

Overloaded methods

copy

checksumCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Checksum

checksum: the tChecksum to copy

-> m Checksum

Returns: the copy of the passed tChecksum. Use checksumFree when finished using it.

Copies a tChecksum. If checksum has been closed, by calling checksumGetString or g_checksum_get_digest(), the copied checksum will be closed as well.

Since: 2.16

free

checksumFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Checksum

checksum: a tChecksum

-> m () 

Frees the memory allocated for checksum.

Since: 2.16

getString

checksumGetString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Checksum

checksum: a tChecksum

-> m Text

Returns: the hexadecimal representation of the checksum. The returned string is owned by the checksum and should not be modified or freed.

Gets the digest as a hexadecimal string.

Once this function has been called the tChecksum can no longer be updated with checksumUpdate.

The hexadecimal characters will be lower case.

Since: 2.16

new

checksumNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ChecksumType

checksumType: the desired type of checksum

-> m Checksum

Returns: the newly created tChecksum, or Nothing. Use checksumFree to free the memory allocated by it.

Creates a new tChecksum, using the checksum algorithm checksumType. If the checksumType is not known, Nothing is returned. A tChecksum can be used to compute the checksum, or digest, of an arbitrary binary blob, using different hashing algorithms.

A tChecksum works by feeding a binary blob through checksumUpdate until there is data to be checked; the digest can then be extracted using checksumGetString, which will return the checksum as a hexadecimal string; or g_checksum_get_digest(), which will return a vector of raw bytes. Once either checksumGetString or g_checksum_get_digest() have been called on a tChecksum, the checksum will be closed and it won't be possible to call checksumUpdate on it anymore.

Since: 2.16

reset

checksumReset Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Checksum

checksum: the tChecksum to reset

-> m () 

Resets the state of the checksum back to its initial state.

Since: 2.18

typeGetLength

checksumTypeGetLength Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ChecksumType

checksumType: a tChecksumType

-> m Int64

Returns: the checksum length, or -1 if checksumType is not supported.

Gets the length in bytes of digests of type checksumType

Since: 2.16

update

checksumUpdate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Checksum

checksum: a tChecksum

-> ByteString

data: buffer used to compute the checksum

-> m () 

Feeds data into an existing tChecksum. The checksum must still be open, that is checksumGetString or g_checksum_get_digest() must not have been called on checksum.

Since: 2.16