Skip to content

Lua API Crypto

Leonard Ramminger edited this page Aug 10, 2026 · 1 revision

Lua API — Crypto (beez.crypto)

Hash files and strings, encode bytes, and compute HMAC digests.


Functions

FunctionInputOutput
list_hash_algo(){ "sha256", …, "sdbm" }
list_encode_algo(){ "hex", "base64" }
is_hash(name)stringboolean
is_encoding_algo(name)stringboolean
hash_string(data, algorithm)string, stringhex digest
hash_file(path, [algorithm])path, string?hex digest (default sha256)
encode(data)stringhex
encode(data, encoding)string, "hex"|"base64"encoded string
encode(data, key, hash)string, string, stringHMAC hex

Hash algorithms

  • Digests:sha256, sha512, sha1, md5
  • Fingerprints:fnv1a64, fnv1a32, crc32, djb2, sdbm

Examples

localsha=beez.crypto.hash_string("payload", "sha256")
localfile_hash=beez.crypto.hash_file("dist/app.tar.gz")
localb64=beez.crypto.encode("hello", "base64")
localmac=beez.crypto.encode("message", "secret-key", "sha256")

Use with beez.net.download_and_verify to verify downloads.


← Lua API Overview

Clone this wiki locally