tiny_httpd/ocaml/Stdlib/Digest/MD5/index.html
2025-03-21 12:40:14 +00:00

2 lines
7.4 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>MD5 (ocaml.Stdlib.Digest.MD5)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.0.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../../../index.html">Index</a> &#x00BB; <a href="../../../index.html">ocaml</a> &#x00BB; <a href="../../index.html">Stdlib</a> &#x00BB; <a href="../index.html">Digest</a> &#x00BB; MD5</nav><header class="odoc-preamble"><h1>Module <code><span>Digest.MD5</span></code></h1><p><code>MD5</code> is the MD5 hash function. It produces 128-bit (16-byte) digests and is not cryptographically secure at all. It should be used only for compatibility with earlier designs that mandate the use of MD5.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 5.2</li></ul></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span><span> = string</span></code></div><div class="spec-doc"><p>The type of digests.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-hash_length"><a href="#val-hash_length" class="anchor"></a><code><span><span class="keyword">val</span> hash_length : int</span></code></div><div class="spec-doc"><p>The length of digests, in bytes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span><span class="keyword">val</span> compare : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Compare two digests, with the same specification as <a href="../../index.html#val-compare"><code>Stdlib.compare</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span><span class="keyword">val</span> equal : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>Test two digests for equality.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string"><a href="#val-string" class="anchor"></a><code><span><span class="keyword">val</span> string : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Return the digest of the given string.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-bytes"><a href="#val-bytes" class="anchor"></a><code><span><span class="keyword">val</span> bytes : <span>bytes <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Return the digest of the given byte sequence.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-substring"><a href="#val-substring" class="anchor"></a><code><span><span class="keyword">val</span> substring : <span>string <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>substring s ofs len</code> returns the digest of the substring of <code>s</code> starting at index <code>ofs</code> and containing <code>len</code> characters.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-subbytes"><a href="#val-subbytes" class="anchor"></a><code><span><span class="keyword">val</span> subbytes : <span>bytes <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>subbytes s ofs len</code> returns the digest of the subsequence of <code>s</code> starting at index <code>ofs</code> and containing <code>len</code> bytes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-channel"><a href="#val-channel" class="anchor"></a><code><span><span class="keyword">val</span> channel : <span><a href="../../index.html#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Read characters from the channel and return their digest. See <a href="../index.html#val-channel"><code>Digest.channel</code></a> for the full specification.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-file"><a href="#val-file" class="anchor"></a><code><span><span class="keyword">val</span> file : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Return the digest of the file whose name is given.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output"><a href="#val-output" class="anchor"></a><code><span><span class="keyword">val</span> output : <span><a href="../../index.html#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write a digest on the given output channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input"><a href="#val-input" class="anchor"></a><code><span><span class="keyword">val</span> input : <span><a href="../../index.html#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Read a digest from the given input channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_hex"><a href="#val-to_hex" class="anchor"></a><code><span><span class="keyword">val</span> to_hex : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Return the printable hexadecimal representation of the given digest.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <a href="../../index.html#exception-Invalid_argument"><code>Invalid_argument</code></a> <p>if the length of the argument is not <code>hash_length</code>,</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_hex"><a href="#val-of_hex" class="anchor"></a><code><span><span class="keyword">val</span> of_hex : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Convert a hexadecimal representation back into the corresponding digest.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <a href="../../index.html#exception-Invalid_argument"><code>Invalid_argument</code></a> <p>if the length of the argument is not <code>2 * hash_length</code>, or if the arguments contains non-hexadecimal characters.</p></li></ul></div></div></div></body></html>