GLib.Checksum.new
function new(checksum_type: GLib.ChecksumType): GLib.Checksum { // Gjs wrapper for g_checksum_new() }
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.
A GLib.Checksum works by feeding a binary blob through GLib.Checksum.prototype.update until there is data to be checked; the digest can then be extracted using GLib.Checksum.prototype.get_string, which will return the checksum as a hexadecimal string; or GLib.Checksum.get_digest, which will return a vector of raw bytes. Once either GLib.Checksum.prototype.get_string or GLib.Checksum.get_digest have been called on a GLib.Checksum, the checksum will be closed and it won't be possible to call GLib.Checksum.prototype.update on it anymore.
Since 2.16
- checksum_type
the desired type of checksum
- Returns
the newly created GLib.Checksum, or null. Use GLib.Checksum.prototype.free to free the memory allocated by it.