Skip to main content
rb.hash turns a string into a hash or checksum. A script reaches for it to check that data has not changed, to build a cache key, or to sign a request with a shared secret. This script hashes a string, signs a message, and hashes bytes that are not UTF-8:
algo is "sha256", "sha512" or "sha1"; anything else raises unknown HMAC algo: <algo>. data, and key for hmac, must be valid UTF-8; other bytes raise. To hash binary data, hash rb.codec.hex(data) or rb.codec.base64(data) instead.