checksum


Description:

[ Version ( since = "1.0.2" ) ]
public string checksum (string csumtype, string path) throws Error

compute MD5, SHAx or CRC checksum of file

This call computes the MD5, SHAx or CRC checksum of the file named path.

The type of checksum to compute is given by the csumtype parameter which must have one of the following values:

crc Compute the cyclic redundancy check (CRC) specified by POSIX for the cksum command.

gost gost12 Compute the checksum using GOST R34.11-94 or GOST R34.11-2012 message digest.

md5 Compute the MD5 hash (using the md5sum(1) program).

sha1 Compute the SHA1 hash (using the sha1sum(1) program).

sha224 Compute the SHA224 hash (using the sha224sum(1) program).

sha256 Compute the SHA256 hash (using the sha256sum(1) program).

sha384 Compute the SHA384 hash (using the sha384sum(1) program).

sha512 Compute the SHA512 hash (using the sha512sum(1) program).

The checksum is returned as a printable string.

To get the checksum for a device, use checksum_device.

To get the checksums for many files, use checksums_out.

Parameters:

this

A GuestfsSession object

Returns:

the returned string, or NULL on error