Checksum

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

Constructors

this
this(GChecksum* gChecksum, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(GChecksumType checksumType)

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

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

copy
Checksum copy()

Copies a glib.Checksum If checksum has been closed, by calling Checksum.getString or Checksum.getDigest, the copied checksum will be closed as well.

free
void free()

Frees the memory allocated for checksum.

getChecksumStruct
GChecksum* getChecksumStruct(bool transferOwnership)

Get the main Gtk struct

getDigest
void getDigest(ubyte[] buffer)

Gets the digest from checksum as a raw binary vector and places it into buffer. The size of the digest depends on the type of checksum.

getString
string getString()

Gets the digest as a hexadecimal string.

getStruct
void* getStruct()

the main Gtk struct as a void*

reset
void reset()

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

update
void update(char[] data)

Feeds data into an existing glib.Checksum The checksum must still be open, that is Checksum.getString or Checksum.getDigest must not have been called on checksum.

Static functions

computeChecksumForBytes
string computeChecksumForBytes(GChecksumType checksumType, Bytes data)

Computes the checksum for a binary data. This is a convenience wrapper for Checksum.new, Checksum.getString and Checksum.free.

computeChecksumForData
string computeChecksumForData(GChecksumType checksumType, char[] data)

Computes the checksum for a binary data of length. This is a convenience wrapper for Checksum.new, Checksum.getString and Checksum.free.

computeChecksumForString
string computeChecksumForString(GChecksumType checksumType, string str, ptrdiff_t length)

Computes the checksum of a string.

typeGetLength
ptrdiff_t typeGetLength(GChecksumType checksumType)

Gets the length in bytes of digests of type checksum_type

Variables

gChecksum
GChecksum* gChecksum;

the main Gtk struct

Meta

Since

2.16