diff --git a/doc/scsh-manual/miscprocs.tex b/doc/scsh-manual/miscprocs.tex index 2af4cdd..2aa5a80 100644 --- a/doc/scsh-manual/miscprocs.tex +++ b/doc/scsh-manual/miscprocs.tex @@ -357,6 +357,53 @@ not necessary to explicitly open a syslog channel to do logging. specified form of calling \ex{syslog} logs to the specified channel. \end{desc} + +\section{MD5 interface} +\label{sec:md5} + +Scsh provides a direct interface to the MD5 functions to compute the +``fingerprint'' or ``message digest'' of a file or string. It uses the +C library written by Colin Plum. + +\defun{md5-digest-for-string}{string}{md5-digest} +\begin{desc} + Calculates the MD5 digest for the given string. +\end{desc} +\defun{md5-digest-for-port}{port [buffer-size]}{md5-digest} +\begin{desc} + Reads the contents of the port and calculates the MD5 digest for it. +\end{desc} + +\defun{md5-digest?}{thing}{boolean} +\begin{desc} + The type predicate for MD5 digests: \ex{md5-digest?} returns true if + and only if \var{thing} is a MD5 digest. +\end{desc} +\defun{md5-digest->number}{md5-digest}{number} +\begin{desc} + Returns the number corresponding to the MD5 digest. +\end{desc} +\defun{number->md5-digest}{number}{md5-digest} +\begin{desc} + Creates a MD5 digest from a number. +\end{desc} + +\defun{make-md5-context}{}{md5-context} +\defunx{md5-context?}{thing}{boolean} +\defunx{update-md5-context!}{md5-context string}\undefined +\defunx{md5-context->md5-digest}{md5-context}{md5-digest} +\begin{desc} + These procedures provide a low-level interface to the library. A + \var{md5-context} stores the state of a MD5 computation, it is + created by \ex{make-md5-context}, its type predicate is + \ex{md5-context?}. The procedure \ex{update-md5-context!} extends + the \var{md5-context} by the given string. Finally, + \ex{md5-context->md5-digest} returns the \var{md5-digest} for the + \var{md5-context}. With these procedures it is possible to + incrementally add strings to a \var{md5-context} before computing + the digest. +\end{desc} + %%% Local Variables: %%% mode: latex %%% TeX-master: "man"