Cryptography & Hashing (`hash`)
Compute cryptographic digests using MD5 and SHA-256 algorithms for tamper detection, integrity verification, asset caching keys, and signatures.
1. Getting Started
hashing_demo.lua
import hash
data = "SecretPassword123"
md5Sum = hash.md5(data)
shaSum = hash.sha256(data)
print("MD5: " .. md5Sum)
print("SHA256: " .. shaSum)
2. Functions Reference
| Function | Signature | Digest Output Length | Description |
|---|---|---|---|
hash.md5(data) |
(string) → string |
32 hex characters | Computes 128-bit MD5 digest. Fast, suitable for cache keys and checksums. |
hash.sha256(data) |
(string) → string |
64 hex characters | Computes 256-bit SHA-2 cryptographic digest. Secure against collision attacks. |