@eryx/crypto/hazmat/hash Module

Cryptographic hash functions.

Use new to create a streaming hash context.

local hash = require("@eryx/crypto/hazmat/hash")
local hex = require("@eryx/encoding/hex")

local ctx = hash.new("sha256")
ctx:update(buffer.fromstring("hel"))
ctx:update(buffer.fromstring("lo"))
print(hex.encode(ctx:final()))
-- "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"

Summary

Classes

Context:update(data: buffer)()
Context:final()buffer
Context:close()()

Functions

hash.new(algorithm: string)Context

API Reference

Classes

Context

Properties

Context:update

Context:update(data: buffer)()

Context:final

Context:final()buffer

Context:close

Context:close()()

Functions

hash.new

Creates an incremental hash context.

Supported algorithms currently include "md5", "sha1", "sha224", "sha256", "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", and "sha3_512".

hash.new(algorithm: string)Context

Parameters

algorithm: string

Hash algorithm name.

Returns

Streaming hash context.