Version: v0.6.1 - Beta.  We welcome contributors & feedback.  THanks!




Apply one-way hash encryption to the string, using the SHA-256 algorithm.

A hashed string can not be decrypted back to its plaintext.

It will always be 64 characters long, regardless of the input length.

The hash will always be the same for a given input string, making it suitable for message digests or other fingerprinting.

SecurityDo NOT use this method for passwords. Use toPassword() for stronger encryption instead.

$correctHash = 'a591a6d40bf420404a011733cfb7b1...';

$fileContent ='importantFile.txt', true);
$fileHash = fileContent.hash();

if $fileHash != $correctHash {
    // File content has been changed

See Also