man-pages/man3/Digest.3o.html
2021-03-31 01:06:50 +01:00

304 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Digest</TITLE>
</HEAD><BODY>
<H1>Digest</H1>
Section: OCaml library (3o)<BR>Updated: 2020-01-30<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Digest - MD5 message digest.
<A NAME="lbAC">&nbsp;</A>
<H2>Module</H2>
Module Digest
<A NAME="lbAD">&nbsp;</A>
<H2>Documentation</H2>
<P>
Module
<B>Digest</B>
<BR>&nbsp;:&nbsp;
<B>sig end</B>
<P>
<P>
MD5 message digest.
<P>
This module provides functions to compute 128-bit 'digests' of
arbitrary-length strings or files. The digests are of cryptographic
quality: it is very hard, given a digest, to forge a string having
that digest. The algorithm used is MD5. This module should not be
used for secure and sensitive cryptographic applications. For these
kind of applications more recent and stronger cryptographic
primitives should be used instead.
<P>
<P>
<P>
<P>
<P>
<I>type t </I>
=
<B>string</B>
<P>
<P>
The type of digests: 16-character strings.
<P>
<P>
<P>
<I>val compare </I>
:
<B>t -&gt; t -&gt; int</B>
<P>
The comparison function for 16-character digest, with the same
specification as
<B>compare</B>
and the implementation
shared with
<B>String.compare</B>
. Along with the type
<B>t</B>
, this
function
<B>compare</B>
allows the module
<B>Digest</B>
to be passed as
argument to the functors
<B>Set.Make</B>
and
<B>Map.Make</B>
.
<P>
<P>
<B>Since</B>
4.00.0
<P>
<P>
<P>
<I>val equal </I>
:
<B>t -&gt; t -&gt; bool</B>
<P>
The equal function for 16-character digest.
<P>
<P>
<B>Since</B>
4.03.0
<P>
<P>
<P>
<I>val string </I>
:
<B>string -&gt; t</B>
<P>
Return the digest of the given string.
<P>
<P>
<P>
<I>val bytes </I>
:
<B>bytes -&gt; t</B>
<P>
Return the digest of the given byte sequence.
<P>
<P>
<B>Since</B>
4.02.0
<P>
<P>
<P>
<I>val substring </I>
:
<B>string -&gt; int -&gt; int -&gt; t</B>
<P>
<P>
<B>Digest.substring s ofs len</B>
returns the digest of the substring
of
<B>s</B>
starting at index
<B>ofs</B>
and containing
<B>len</B>
characters.
<P>
<P>
<P>
<I>val subbytes </I>
:
<B>bytes -&gt; int -&gt; int -&gt; t</B>
<P>
<P>
<B>Digest.subbytes s ofs len</B>
returns the digest of the subsequence
of
<B>s</B>
starting at index
<B>ofs</B>
and containing
<B>len</B>
bytes.
<P>
<P>
<B>Since</B>
4.02.0
<P>
<P>
<P>
<I>val channel </I>
:
<B>in_channel -&gt; int -&gt; t</B>
<P>
If
<B>len</B>
is nonnegative,
<B>Digest.channel ic len</B>
reads
<B>len</B>
characters from channel
<B>ic</B>
and returns their digest, or raises
<B>End_of_file</B>
if end-of-file is reached before
<B>len</B>
characters
are read. If
<B>len</B>
is negative,
<B>Digest.channel ic len</B>
reads
all characters from
<B>ic</B>
until end-of-file is reached and return
their digest.
<P>
<P>
<P>
<I>val file </I>
:
<B>string -&gt; t</B>
<P>
Return the digest of the file whose name is given.
<P>
<P>
<P>
<I>val output </I>
:
<B>out_channel -&gt; t -&gt; unit</B>
<P>
Write a digest on the given output channel.
<P>
<P>
<P>
<I>val input </I>
:
<B>in_channel -&gt; t</B>
<P>
Read a digest from the given input channel.
<P>
<P>
<P>
<I>val to_hex </I>
:
<B>t -&gt; string</B>
<P>
Return the printable hexadecimal representation of the given digest.
Raise
<B>Invalid_argument</B>
if the argument is not exactly 16 bytes.
<P>
<P>
<P>
<I>val from_hex </I>
:
<B>string -&gt; t</B>
<P>
Convert a hexadecimal representation back into the corresponding digest.
Raise
<B>Invalid_argument</B>
if the argument is not exactly 32 hexadecimal
characters.
<P>
<P>
<B>Since</B>
4.00.0
<P>
<P>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">Module</A><DD>
<DT id="3"><A HREF="#lbAD">Documentation</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:38 GMT, March 31, 2021
</BODY>
</HTML>