Version: v0.5.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.

let correctHash = 'a591a6d40bf420404a011733cfb7b1...';

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

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

See Also