Checksum

class Checksum(pointer: <Error class: unknown class><<Error class: unknown class>>) : ProxyInstance

GLib provides a generic API for computing checksums (or ‘digests’) for a sequence of arbitrary bytes, using various hashing algorithms like MD5, SHA-1 and SHA-256. Checksums are commonly used in various environments and specifications.

To create a new GChecksum, use ctor@GLib.Checksum.new. To free a GChecksum, use method@GLib.Checksum.free.

GLib supports incremental checksums using the GChecksum data structure, by calling method@GLib.Checksum.update as long as there’s data available and then using method@GLib.Checksum.get_string or method@GLib.Checksum.get_digest to compute the checksum and return it either as a string in hexadecimal form, or as a raw sequence of bytes. To compute the checksum for binary blobs and nul-terminated strings in one go, use the convenience functions func@GLib.compute_checksum_for_data and func@GLib.compute_checksum_for_string, respectively.

Skipped during bindings generation

  • method get_digest: In/Out parameter is not supported

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

Since

2.16

Constructors

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

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val glibChecksumPointer: <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
fun copy(): Checksum

Copies a #GChecksum. If @checksum has been closed, by calling g_checksum_get_string() or g_checksum_get_digest(), the copied checksum 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
fun free()

Frees the memory allocated for @checksum.

Link copied to clipboard

Gets the digest as a hexadecimal string.

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

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