<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.xpass.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'xpass.constants.php',
    1 => 'Costanti predefinite',
    2 => 'Costanti predefinite',
  ),
  'up' => 
  array (
    0 => 'book.xpass.php',
    1 => 'Xpass',
  ),
  'prev' => 
  array (
    0 => 'xpass.installation.php',
    1 => 'Installation via PECL',
  ),
  'next' => 
  array (
    0 => 'ref.xpass.php',
    1 => 'Xpass Funzioni',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/xpass/constants.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="xpass.constants" class="appendix">
 <h1 class="title">Costanti predefinite</h1>

 <p class="simpara">
Queste costanti sono definite da questa estensione e 
sono disponibili solo se l&#039;estensione è stata compilata
nel PHP o se è stata caricata dinamicamente a runtime.
</p>

 <p class="simpara">
  Xpass extension provides various set of constants.
  Hash methods (<strong><code><a href="xpass.constants.php#constant.crypt-prefix-std-des">CRYPT_PREFIX_<span class="replaceable">*</span></a></code></strong>) for
  <span class="function"><a href="function.crypt-gensalt.php" class="function">crypt_gensalt()</a></span> prefix parameter.
  Error codes (<strong><code><a href="xpass.constants.php#constant.crypt-salt-ok">CRYPT_SALT_<span class="replaceable">*</span></a></code></strong>) returned by
  <span class="function"><a href="function.crypt-checksalt.php" class="function">crypt_checksalt()</a></span>.
  Password algorithms (<strong><code><a href="password.constants.php#constant.password-bcrypt">PASSWORD_<span class="replaceable">*</span></a></code></strong>) for
  <span class="function"><a href="function.password-hash.php" class="function">password_hash()</a></span> algo parameter.
 </p>

 <dl id="xpass.constants.algo">
  <strong class="title">Hashing methods</strong>
  
   <dt id="constant.crypt-prefix-std-des">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-std-des">CRYPT_PREFIX_STD_DES</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     The original hashing method from Unix V7, based on the DES block cipher.
     Because DES is cheap on modern hardware,
     because there are only <code class="literal">4096</code> possible salts and 2**56 distinct passphrases,
     which it truncates to 8 characters,
     it is feasible to discover any passphrase hashed with this method.
     It should only be used when supporting old operating systems that support
     no other hash generation algorithm, due to how weak DES hashes are.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-ext-des">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-ext-des">CRYPT_PREFIX_EXT_DES</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     An extension of traditional DES, which eliminates the length limit,
     increases the salt size, and makes the time cost tunable.
     It originates with BSDI BSD/OS and is also available on at least NetBSD,
     OpenBSD, and FreeBSD due to the use of David Burren&#039;s FreeSec library.
     It is much better than traditional DES and bigcrypt,
     but still should not be used for new hashes.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-md5">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-md5">CRYPT_PREFIX_MD5</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     A hash based on the MD5 algorithm, originally developed by Poul-Henning Kamp for FreeBSD.
     Supported on most free Unixes and newer versions of Solaris.
     Not as weak as the DES-based hashes below,
     but MD5 is so cheap on modern hardware that it should not be used for new hashes.
     Processing cost is not adjustable.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-blowfish">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-blowfish">CRYPT_PREFIX_BLOWFISH</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     A hash based on the Blowfish block cipher, modified to have an extra-expensive key schedule.
     Originally developed by Niels Provos and David Mazieres for OpenBSD and also supported on recent
     versions of FreeBSD and NetBSD, on Solaris 10 and newer, and on several GNU/*/Linux distributions.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-sha256">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-sha256">CRYPT_PREFIX_SHA256</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     A hash based on SHA-2 with 256-bit output, originally developed by Ulrich Drepper for GNU libc.
     Supported on Linux but not common elsewhere.
     Acceptable for new hashes.
     The default processing cost parameter is <code class="literal">5000</code>,
     which is too low for modern hardware.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-sha512">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-sha512">CRYPT_PREFIX_SHA512</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     A hash based on SHA-2 with 512-bit output, originally developed by Ulrich Drepper for GNU libc.
     Supported on Linux but not common elsewhere.
     Acceptable for new hashes.
     The default processing cost parameter is <code class="literal">5000</code>,
     which is too low for modern hardware.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-scrypt">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-scrypt">CRYPT_PREFIX_SCRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Scrypt is a password-based key derivation function created by Colin Percival,
     originally for the Tarsnap online backup service.
     The algorithm was specifically designed to make it costly to perform
     large-scale custom hardware attacks by requiring large amounts of memory.
     In 2016, the scrypt algorithm was published by IETF as RFC 7914.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-gost-yescrypt">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-gost-yescrypt">CRYPT_PREFIX_GOST_YESCRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Gost-yescrypt uses the output from yescrypt as an input message to HMAC with the
     GOST R 34.11-2012 (Streebog) hash function with a 256-bit digest.
     Thus, yescrypt&#039;s cryptographic properties are superseded by those of the GOST hash function.
     This hashing method is useful in applications that need modern passphrase hashing,
     but have to rely on GOST algorithms.
     The GOST R 34.11-2012 (Streebog) hash function has been published by the IETF as RFC 6986.
     Acceptable for new hashes where required.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-yescrypt">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-yescrypt">CRYPT_PREFIX_YESCRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Yescrypt is a scalable passphrase hashing scheme designed by Solar Designer,
     which is based on Colin Percival&#039;s scrypt.
     While yescrypt&#039;s strength against password guessing attacks comes from its algorithm design,
     its cryptographic security is guaranteed by its use of SHA-256 on the outer layer.
     The SHA-256 hash function has been published by NIST in FIPS PUB 180-2
     (and its subsequent revisions such as FIPS PUB 180-4) and by the IETF as RFC 4634
     (and subsequently RFC 6234).
     Recommended for new hashes.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-sm3crypt">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-sm3crypt">CRYPT_PREFIX_SM3CRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     A hash based on the ShangMi 3 hash function with 256-bit output,
     that uses the same design as sha256crypt and/or sha512crypt.
     Supported on EulerOS, Kylin, openEuler, and openKylin, but not common
     elsewhere. Acceptable for new hashes where required. The default
     processing cost parameter is 5000, which is too low for modern hardware.
    </span>
    <span class="simpara">
     Available as of 1.2.0 with libcxcrypt &gt;= 4.5.0.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-prefix-sm3-yescrypt">
    <strong><code><a href="xpass.constants.php#constant.crypt-prefix-sm3-yescrypt">CRYPT_PREFIX_SM3_YESCRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Sm3-yescrypt uses the output from yescrypt as an input message to HMAC
     with the ShangMi 3 hash function with a 256-bit digest. Thus, yescrypt&#039;s
     cryptographic properties are superseded by those of the ShangMi 3 hash
     function. This hashing method is useful in applications that need modern
     passphrase hashing, but have to rely on algorithms approved by the Chinese
     Office of State Commercial Cryptography Administration (OSCCA). The ShangMi
     3 hash function has been published in Part 3: &quot;Dedicated hash-functions&quot;
     of the ISO/IEC 10118-3:2018. Acceptable for new hashes where required.
    </span>
    <span class="simpara">
     Available as of 1.2.0 with libcxcrypt &gt;= 4.5.0.
    </span>
   </dd>
  
 </dl>

 <dl id="xpass.constants.error">
  <strong class="title">Error codes</strong>
  
   <dt id="constant.crypt-salt-ok">
    <strong><code><a href="xpass.constants.php#constant.crypt-salt-ok">CRYPT_SALT_OK</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     No error.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-salt-invalid">
    <strong><code><a href="xpass.constants.php#constant.crypt-salt-invalid">CRYPT_SALT_INVALID</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Unknown hashing method or invalid parameters.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-salt-method-disabled">
    <strong><code><a href="xpass.constants.php#constant.crypt-salt-method-disabled">CRYPT_SALT_METHOD_DISABLED</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Hashing method is no longer allowed to be used.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-salt-method-legacy">
    <strong><code><a href="xpass.constants.php#constant.crypt-salt-method-legacy">CRYPT_SALT_METHOD_LEGACY</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Hashing method is no longer considered strong enough.
    </span>
   </dd>
  
  
   <dt id="constant.crypt-salt-too-cheap">
    <strong><code><a href="xpass.constants.php#constant.crypt-salt-too-cheap">CRYPT_SALT_TOO_CHEAP</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Cost parameters are considered too cheap.
    </span>
   </dd>
  
 </dl>

 <dl id="xpass.constants.password">
  <strong class="title">Password algorithms</strong>
  
   <dt id="constant.password-sha512">
    <strong><code><a href="xpass.constants.php#constant.password-sha512">PASSWORD_SHA512</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     <strong><code><a href="xpass.constants.php#constant.password-sha512">PASSWORD_SHA512</a></code></strong> is used to create new password
     hashes using the <strong><code><a href="xpass.constants.php#constant.crypt-prefix-sha512">CRYPT_PREFIX_SHA512</a></code></strong> algorithm.
    </span>
   </dd>
  
  
   <dt id="constant.password-yescrypt">
    <strong><code><a href="xpass.constants.php#constant.password-yescrypt">PASSWORD_YESCRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     <strong><code><a href="xpass.constants.php#constant.password-yescrypt">PASSWORD_YESCRYPT</a></code></strong> is used to create new password
     hashes using the <strong><code><a href="xpass.constants.php#constant.crypt-prefix-yescrypt">CRYPT_PREFIX_YESCRYPT</a></code></strong> algorithm.
    </span>
   </dd>
  
  
   <dt id="constant.password-sm3crypt">
    <strong><code><a href="xpass.constants.php#constant.password-sm3crypt">PASSWORD_SM3CRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     <strong><code><a href="xpass.constants.php#constant.password-sm3crypt">PASSWORD_SM3CRYPT</a></code></strong> is used to create new password
     hashes using the <strong><code><a href="xpass.constants.php#constant.crypt-prefix-sm3crypt">CRYPT_PREFIX_SM3CRYPT</a></code></strong> algorithm.
    </span>
    <span class="simpara">
     Available as of 1.2.0 with libcxcrypt &gt;= 4.5.0.
    </span>
   </dd>
  
  
   <dt id="constant.password-sm3-yescrypt">
    <strong><code><a href="xpass.constants.php#constant.password-sm3-yescrypt">PASSWORD_SM3_YESCRYPT</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     <strong><code><a href="xpass.constants.php#constant.password-sm3-yescrypt">PASSWORD_SM3_YESCRYPT</a></code></strong> is used to create new password
     hashes using the <strong><code><a href="xpass.constants.php#constant.crypt-prefix-sm3-yescrypt">CRYPT_PREFIX_SM3_YESCRYPT</a></code></strong> algorithm.
    </span>
    <span class="simpara">
     Available as of 1.2.0 with libcxcrypt &gt;= 4.5.0.
    </span>
   </dd>
  
 </dl>
</div>
<?php manual_footer($setup); ?>