<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Bcrypt" rel="Chapter" href="Bcrypt.html"><link title="Exceptions" rel="Section" href="#1_Exceptions"> <link title="Type definitions" rel="Section" href="#1_Typedefinitions"> <link title="Public functions and values" rel="Section" href="#1_Publicfunctionsandvalues"> <title>Bcrypt</title> </head> <body> <div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> </div> <h1>Module <a href="type_Bcrypt.html">Bcrypt</a></h1> <pre><span class="keyword">module</span> Bcrypt: <code class="code">sig</code> <a href="Bcrypt.html">..</a> <code class="code">end</code></pre><div class="info module top"> Module for safe salting and hashing of passwords using the Bcrypt algorithm.<br> </div> <hr width="100%"> <br> <h1 id="1_Exceptions">Exceptions</h1><br> <pre><span id="EXCEPTIONInvalid_count"><span class="keyword">exception</span> Invalid_count</span> <span class="keyword">of</span> <code class="type">int</code></pre> <div class="info "> The provided <code class="code">count</code> is invalid. The <code class="code">count</code> must be an integer between 4 and 31, inclusive.<br> </div> <pre><span id="EXCEPTIONInvalid_seed"><span class="keyword">exception</span> Invalid_seed</span> <span class="keyword">of</span> <code class="type">string</code></pre> <div class="info "> The given string <code class="code">seed</code> cannot be used as seed. Please provide a string at least 16 bytes long.<br> </div> <pre><span id="EXCEPTIONUrandom_error"><span class="keyword">exception</span> Urandom_error</span> <span class="keyword">of</span> <code class="type">exn</code></pre> <div class="info "> An exception occurred obtaining random seed from <code class="code">/dev/urandom</code>.<br> </div> <pre><span id="EXCEPTIONGensalt_error"><span class="keyword">exception</span> Gensalt_error</span></pre> <div class="info "> An exception occurred in backend's <code class="code">_crypt_gensalt_blowfish_rn</code> function.<br> </div> <pre><span id="EXCEPTIONBcrypt_error"><span class="keyword">exception</span> Bcrypt_error</span></pre> <div class="info "> An exception ocurred in backend's <code class="code">_crypt_blowfish_rn</code> function.<br> </div> <br> <h1 id="1_Typedefinitions">Type definitions</h1><br> <pre><span id="TYPEhash_t"><span class="keyword">type</span> <code class="type"></code>hash_t</span> </pre> <div class="info "> Abstract type holding a password in salted and hashed form. Use function <a href="Bcrypt.html#VALhash"><code class="code">Bcrypt.hash</code></a> to generate a hash.<br> </div> <br> <h1 id="1_Publicfunctionsandvalues">Public functions and values</h1><br> <pre><span id="VALhash"><span class="keyword">val</span> hash</span> : <code class="type">?count:int -> ?seed:string -> string -> <a href="Bcrypt.html#TYPEhash_t">hash_t</a></code></pre><div class="info "> Call <code class="code">hash ?count ?seed password</code> to hash the given password string. The password is automatically salted before hashing. If <code class="code">seed</code> is not given, the salting procedure automatically fetches a seed from <code class="code">/dev/urandom</code>. If given, <code class="code">seed</code> must be a string at least 16 bytes long. The <code class="code">count</code> parameter is the log<sub class="subscript">2</sub> number of Blowfish iterations to use in the hashing procedure. Its default value is 6, and any integer between 4 and 31 (inclusive) may be used.<br> </div> <pre><span id="VALverify"><span class="keyword">val</span> verify</span> : <code class="type">string -> <a href="Bcrypt.html#TYPEhash_t">hash_t</a> -> bool</code></pre><div class="info "> Call <code class="code">verify password hash</code> to verify if the given password matches the previously hashed password.<br> </div> <pre><span id="VALhash_of_string"><span class="keyword">val</span> hash_of_string</span> : <code class="type">string -> <a href="Bcrypt.html#TYPEhash_t">hash_t</a></code></pre><div class="info "> Convert <code class="code">string</code> to <a href="Bcrypt.html#TYPEhash_t"><code class="code">Bcrypt.hash_t</code></a><br> </div> <pre><span id="VALstring_of_hash"><span class="keyword">val</span> string_of_hash</span> : <code class="type"><a href="Bcrypt.html#TYPEhash_t">hash_t</a> -> string</code></pre><div class="info "> Convert <a href="Bcrypt.html#TYPEhash_t"><code class="code">Bcrypt.hash_t</code></a> to <code class="code">string</code><br> </div> </body></html>