% This LaTeX document was generated using the LaTeX backend of PlDoc,
% The SWI-Prolog documentation system



\section{library(md5): MD5 hashes}

\label{sec:md5}

\begin{tags}
    \tag{See also}
\verb$library(sha)$, \verb$library(hash_stream)$ and \verb$library(crypto)$.
\end{tags}

Compute MD5 hashes from a Prolog string. This library provides a
lightweight alternative to the general secure hash interface provided by
\verb$library(crypto)$ from the \const{ssl} package.\vspace{0.7cm}

\begin{description}
    \predicate[det]{md5_hash}{3}{+Data, -Hash, +Options}
\arg{Hash} is the MD5 hash of \arg{Data}, The conversion is controlled by
\arg{Options}:

\begin{description}
    \termitem{encoding}{+Encoding}
If \arg{Data} is a sequence of character \textit{codes}, this must be
translated into a sequence of \textit{bytes}, because that is what
the hashing requires. The default encoding is \const{utf8}. The
other meaningful value is \const{octet}, claiming that \arg{Data} contains
raw bytes.
\end{description}

\begin{arguments}
\arg{Data} & is either an atom, string, code-list or char-list. \\
\arg{Hash} & is an atom holding 32 characters, representing the
hash in hexadecimal notation \\
\end{arguments}
\end{description}

