digest.sha512
The digest.sha512 function returns the SHA-512 digest of a string as lowercase hexadecimal. It takes
the same argument as digest.sha256 and returns a 128-character
string. Use it when a registry or checksum file expects SHA-512.
Usage
digest.sha512(data)
Arguments
data- Required. The string to hash, as bytes. File contents from
fs.read_filehash exactly as stored.
Returns
The digest as a 128-character lowercase hexadecimal string.
Example
Verify a download against a SHA-512 checksum file
expected = fs.read_file("release.tar.gz.sha512").split()[0]
actual = digest.sha512(fs.read_file("release.tar.gz"))
if actual != expected:
fail("checksum mismatch for release.tar.gz")
Errors
- A missing argument, or an argument that is not a string, fails with an argument error.
Related
digest.sha256is the usual choice for fingerprints and cache keys.- Atmos Automation Language and the script step