Checksum
Added in version 2.16.
- class Checksum(**kwargs)
- Constructors:
new(checksum_type:GLib.ChecksumType) -> GLib.Checksum or None
Constructors
- class Checksum
- classmethod new(checksum_type: ChecksumType) Checksum | None
Creates a new
Checksum
, using the checksum algorithmchecksum_type
. If thechecksum_type
is not known,None
is returned. AChecksum
can be used to compute the checksum, or digest, of an arbitrary binary blob, using different hashing algorithms.A
Checksum
works by feeding a binary blob throughupdate()
until there is data to be checked; the digest can then be extracted usingget_string()
, which will return the checksum as a hexadecimal string; orget_digest()
, which will return a vector of raw bytes. Once eitherget_string()
orget_digest()
have been called on aChecksum
, the checksum will be closed and it won’t be possible to callupdate()
on it anymore.Added in version 2.16.
- Parameters:
checksum_type – the desired type of checksum
Methods
- class Checksum
-
- get_string() str
Gets the digest as a hexadecimal string.
Once this function has been called the
Checksum
can no longer be updated withupdate()
.The hexadecimal characters will be lower case.
Added in version 2.16.
- type_get_length(checksum_type: ChecksumType) int
Gets the length in bytes of digests of type
checksum_type
Added in version 2.16.
- Parameters:
checksum_type – a
ChecksumType