SHA-256/-384/-512 hashing

View on GitHub
Download as .tar.gz
Download as .zip

local sha2 = require'sha2'

A ffi binding of Aaron Gifford's SHA-2 implementation.

sha2.sha256(s[, size]) -> s
sha2.sha256(cdata, size) -> s
sha2.sha384(s[, size]) -> s
sha2.sha384(cdata, size) -> s
sha2.sha512(s[, size]) -> s
sha2.sha512(cdata, size) -> s
Compute the SHA-2 hash of a string or a cdata buffer. Return the binary representation of the hash. To get the hex representation, use glue.tohex.
sha2.sha256_digest() -> digest
sha2.sha384_digest() -> digest
sha2.sha512_digest() -> digest
digest(s[, size])
digest(cdata, size)
digest() -> s
Get a SHA-2 digest function that can consume multiple data chunks until called with no arguments when it returns the final SHA hash.

See also: md5