<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.crypt2.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.crypt2</api:function-name><api:suggest>xdmp.crypt2</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>crypt2</api:suggest><api:function-link mode="xquery" fullname="xdmp:crypt2">/apidoc/8.0/xdmp:crypt2.xml</api:function-link><api:function mode="javascript" name="crypt2" type="builtin" lib="xdmp" category="Extension" subcategory="Extension" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.crypt2"><api:summary>
  Calculates the password hash for the given plain-text password.
</api:summary><api:params><api:param name="password" type="xs:string"><api:param-description>
    String to be hashed.
  </api:param-description><api:param-name>password</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>String</api:return><api:usage>
<p xmlns="http://www.w3.org/1999/xhtml">The password is encrypted using sha256 encoding and it is salted. A salt
 is generated using base-64 representation of a random number. This
 minimizes the probability of hash collisions even if different users have
 the same password.</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  xdmp.crypt2("123abc");
  =&gt; "$2$aUI4j7YVqvecKkJ7QrK01.$2$ElWEwaxZ"
</pre></api:example></api:function></api:function-page>