freebsd-src/lib/flua/libhash/hash.3lua
Warner Losh f7781d030c flua: Add hash module
Add lua bindings to hashing functions. sha256 is available. sha256.new
craetes a new object. sha256.update updates the digest. sha256.digest
returns the digest as a binary string and resets the
context. sha256.hexdigest returns the digest as a string of hex digits
and then resets the cotnext.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43872
2024-02-15 20:59:23 -07:00

55 lines
1.1 KiB
Plaintext

.\"
.\" Copyright (c) 2024 Netflix, Inc.
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.Dd February 6, 2024
.Dt HASH 3lua
.Os
.Sh NAME
.Nm new ,
.Nm update ,
.Nm digest ,
.Nm hexdigest
.Nd Lua Cryptographic hash module.
.Sh DESCRIPTION
The built-in cryptographic hashing Lua bindings for the are available via the
.Ic hash
table.
.Ss Supported Hashing Schemes
The following hashing schemes are supported by the hash module.
.Bl -bullet -compact
.It
sha256
.El
.Ss APIs Supported
.Bl -tag -width asdf -compact
.It Fn new data
Compute a digest based on the
.Va data .
.It Fn update Va data
Using the current digest, process
.Va data
to compute a new digest as if all prior data had been concatenated together.
.It Fn digest
Return the hashed digest as a binary array.
This resets the context.
.It Fn hexdigest
Take
.Fn digest
and convert it to an upper case hex string.
This resets the context.
.It Va digest_size
Return the size of the digest, in bytes.
.It Va block_size
Return the block size used in bytes.
.El
.Sh EXAMPLES
.Sh SEE ALSO
.Xr sha256 3
.Sh AUTHORS
The
.Nm
man page was written by
.An Warner Losh Aq Mt imp@FreeBSD.org .