Hashes a string with the named algorithm and returns the digest as a hex string.
Accepted algorithms:
"md5" - 32-character digest
"sha1" - 40-character digest
"sha256" - 64-character digest
"sha384" - 96-character digest
"sha512" - 128-character digest
"sha3-256" - 64-character digest
"sha3-512" - 128-character digest
Most commonly used to compare two large strings fastly - hash both and compare them, instead of running a byte-by-byte equality.
Parameters
Returns
string - the hex digest. Length depends on the algorithm (see list above).
Example
Detect whether an upstream file has changed since you last cached it.
Commonly supported algorithms include 'sha1', 'sha256', 'sha512', 'md5'.