summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-08-23 23:06:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-08-23 23:06:09 -0700
commit8a10829e5e35e5b0721260e0a7b31554ec21d766 (patch)
tree037c9464dc75ff36bbfadd0c2f1117fa60b28d75 /txr.1
parent27a722e96f281974e9f49887e9470422dcb1da91 (diff)
downloadtxr-8a10829e5e35e5b0721260e0a7b31554ec21d766.tar.gz
txr-8a10829e5e35e5b0721260e0a7b31554ec21d766.tar.bz2
txr-8a10829e5e35e5b0721260e0a7b31554ec21d766.zip
New state-object-based sha256 and md5 digesting.
* chksum.c (sha256_ctx_s, md5_ctx_s): New symbol variables. (sha256_ops, md5_ops): New static structs. (sha256_begin, sha256_hash, sha256_end, md5_begin, md5_hash, md5_end): New functions. (chksum_init): New symbol variables initialized; sha256-begin, sha256-hash, sha256-end, md5-begin, md5-hash, md5-end intrinsics registered. * chksum.h (sha256_begin, sha256_hash, sha256_end, md5_begin, md5_hash, md5_end): Declared. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.1112
1 files changed, 112 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index d812274a..b8b7c120 100644
--- a/txr.1
+++ b/txr.1
@@ -52382,6 +52382,118 @@ argument is specified, it must be a buffer that is at least 16 bytes long
in the case of MD5, and at least 32 bytes long in the case of SHA-256.
The hash is placed into that buffer, which is then returned.
+.coNP Functions @, sha256-begin @ sha256-hash and @ sha256-end
+.synb
+.mets (sha256-begin)
+.mets (sha256-hash < ctx << obj )
+.mets (sha256-end < ctx <> [ buf ])
+.syne
+.desc
+The three functions
+.codn sha256-begin ,
+.code sha256-hash
+and
+.code sha256-end
+implement a stateful computation of SHA256 digest which allows multiple input
+sources to contribute to the result. Furthermore, the context object may be
+serially re-used for calculating multiple digests.
+
+The
+.code sha256-begin
+function, which takes no arguments, returns a new SHA256 digest-producing
+context object.
+
+The
+.code sha256-hash
+updates the state of the SHA256 digest object
+.meta ctx
+by including
+.meta obj
+into the digest calculation. The
+.meta obj
+argument may be a character string, whose UTF-8 representation is digested,
+or a buffer object, whose contents are digested.
+The
+.code sha256-hash
+function may be called multiple times to include any mixture of
+strings and buffers into the digest calculation.
+
+The
+.code sha256-end
+function finalizes the digest calculation and returns the digest in
+a buffer. If the
+.meta buf
+argument is omitted, then a new 32-byte buffer is created for this
+purpose. Otherwise,
+.meta buf
+must specify a
+.code buf
+object that is at least 32 bytes long. The digest is stored into this
+buffer and that the buffer is returned.
+
+The
+.code sha256-end
+function additionally resets the
+.meta ctx
+object into the initial state of a newly created context object, so
+that it may be used for another digest session.
+
+.coNP Functions @, md5-begin @ md5-hash and @ md5-end
+.synb
+.mets (md5-begin)
+.mets (md5-hash < ctx << obj )
+.mets (md5-end < ctx <> [ buf ])
+.syne
+.desc
+The three functions
+.codn md5-begin ,
+.code md5-hash
+and
+.code md5-end
+implement a stateful computation of MD5 digest which allows multiple input
+sources to contribute to the result. Furthermore, the context object may be
+serially re-used for calculating multiple digests.
+
+The
+.code md5-begin
+function, which takes no arguments, returns a new MD5 digest-producing
+context object.
+
+The
+.code md5-hash
+updates the state of the MD5 digest object
+.meta ctx
+by including
+.meta obj
+into the digest calculation. The
+.meta obj
+argument may be a character string, whose UTF-8 representation is digested,
+or a buffer object, whose contents are digested.
+The
+.code md5-hash
+function may be called multiple times to include any mixture of
+strings and buffers into the digest calculation.
+
+The
+.code md5-end
+function finalizes the digest calculation and returns the digest in
+a buffer. If the
+.meta buf
+argument is omitted, then a new 16-byte buffer is created for this
+purpose. Otherwise,
+.meta buf
+must specify a
+.code buf
+object that is at least 16 bytes long. The digest is stored into this
+buffer and that the buffer is returned.
+
+The
+.code md5-end
+function additionally resets the
+.meta ctx
+object into the initial state of a newly created context object, so
+that it may be used for another digest session.
+
.SS* The Awk Utility
The \*(TL library provides a macro called