1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

Some markup fixes for the new XPass documentation

This commit is contained in:
Gina Peter Banyard
2024-12-20 13:05:06 +00:00
parent 0987e913fc
commit 7b9d57fa44
8 changed files with 123 additions and 138 deletions

View File

@@ -1,20 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.xpass" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<book xml:id="book.xpass" xmlns="http://docbook.org/ns/docbook">
<?phpdoc extension-membership="pecl" ?>
<title>Xpass</title>
<titleabbrev>Xpass</titleabbrev>
<preface xml:id="intro.xpass">
&reftitle.intro;
<para>
<simpara>
This extension provides password hashing algorithms used by Linux
distributions, using extended crypt library.
</para>
<para>
</simpara>
<simpara>
It also provides additional functions from libxcrypt missing in core PHP.
</para>
</simpara>
</preface>
&reference.xpass.setup;
@@ -22,7 +21,6 @@
&reference.xpass.reference;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="xpass.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<appendix xml:id="xpass.constants" xmlns="http://docbook.org/ns/docbook">
&reftitle.constants;
&extension.constants;
<para>
Xpass extension provides various set of constants.
Hash methods (CRYPT_PREFIX_) for <function>crypt_gensalt</function> prefix parameter.
Error codes (CRYPT_SALT_) returned by <function>crypt_checksalt</function>.
Password algorithms (PASSWORD_) for <function>password_hash</function> algo parameter.
</para>
<simpara>
Xpass extension provides various set of constants.
Hash methods (CRYPT_PREFIX_) for <function>crypt_gensalt</function> prefix parameter.
Error codes (CRYPT_SALT_) returned by <function>crypt_checksalt</function>.
Password algorithms (PASSWORD_) for <function>password_hash</function> algo parameter.
</simpara>
<variablelist xml:id="xpass.constants.algo">
<title>Hashing methods</title>
@@ -21,12 +20,13 @@
</term>
<listitem>
<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 4096 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 if you absolutely have to generate hashes that will
work on an old operating system that supports nothing else.
The original hashing method from Unix V7, based on the DES block cipher.
Because DES is cheap on modern hardware,
because there are only <literal>4096</literal> 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 if you absolutely have to generate hashes that will
work on an old operating system that supports nothing else.
</simpara>
</listitem>
</varlistentry>
@@ -37,11 +37,12 @@
</term>
<listitem>
<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's FreeSec library. It is much better than traditional DES
and bigcrypt, but still should not be used for new hashes.
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's FreeSec library.
It is much better than traditional DES and bigcrypt,
but still should not be used for new hashes.
</simpara>
</listitem>
</varlistentry>
@@ -52,10 +53,11 @@
</term>
<listitem>
<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.
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.
</simpara>
</listitem>
</varlistentry>
@@ -80,8 +82,10 @@
<listitem>
<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 5000, which is too low for modern hardware.
Supported on Linux but not common elsewhere.
Acceptable for new hashes.
The default processing cost parameter is <literal>5000</literal>,
which is too low for modern hardware.
</simpara>
</listitem>
</varlistentry>
@@ -93,8 +97,10 @@
<listitem>
<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 5000, which is too low for modern hardware.
Supported on Linux but not common elsewhere.
Acceptable for new hashes.
The default processing cost parameter is <literal>5000</literal>,
which is too low for modern hardware.
</simpara>
</listitem>
</varlistentry>
@@ -105,10 +111,11 @@
</term>
<listitem>
<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.
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.
</simpara>
</listitem>
</varlistentry>
@@ -122,9 +129,10 @@
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'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.
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.
</simpara>
</listitem>
</varlistentry>
@@ -135,12 +143,14 @@
</term>
<listitem>
<simpara>
Yescrypt is a scalable passphrase hashing scheme designed by Solar Designer, which is based
on Colin Percival's scrypt. While yescrypt'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
Yescrypt is a scalable passphrase hashing scheme designed by Solar Designer,
which is based on Colin Percival's scrypt.
While yescrypt'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.
(and subsequently RFC 6234).
Recommended for new hashes.
</simpara>
</listitem>
</varlistentry>
@@ -166,7 +176,7 @@
</term>
<listitem>
<simpara>
Unkown hashing method or invalid parameters.
Unknown hashing method or invalid parameters.
</simpara>
</listitem>
</varlistentry>
@@ -233,7 +243,6 @@
</varlistentry>
</variablelist>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.crypt-checksalt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>crypt_checksalt</refname>
@@ -13,12 +12,12 @@
<type class="union"><type>string</type><type>null</type></type><methodname>crypt_checksalt</methodname>
<methodparam><type>string</type><parameter>salt</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
Checks the salt string against the system configuration and reports whether
the hashing method and parameters it specifies are acceptable.
It is intended to be used to determine whether the user's passphrase should
be re-hashed using the currently preferred hashing method.
</para>
</simpara>
</refsect1>
<refsect1 role="parameters">
@@ -27,9 +26,9 @@
<varlistentry>
<term><parameter>salt</parameter></term>
<listitem>
<para>
<simpara>
Salt string to check.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -37,18 +36,18 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an <type>int</type>, one of CRYPT_SALT_* constant,
see the <link linkend="xpass.constants">Xpass constants</link> page.
</para>
<simpara>
Returns one of the
<constant>CRYPT_SALT_<replaceable>*</replaceable></constant>
as an <type>int</type>.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>crypt_checksalt</function> example</title>
<programlisting role="php">
<example>
<title>A <function>crypt_checksalt</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Generate a salt for a legacy method
@@ -64,29 +63,25 @@ $test = crypt_checksalt($salt);
var_dump($test === CRYPT_SALT_OK);
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(true)
]]>
</screen>
</example>
</para>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>crypt_gensalt</function></member>
</simplelist>
</para>
<simplelist>
<member><function>crypt_gensalt</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.crypt-gensalt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>crypt_gensalt</refname>
@@ -14,9 +13,9 @@
<methodparam choice="opt"><type>string</type><parameter>prefix</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>count</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
<simpara>
Compile a string for use as the salt argument to <function>crypt</function>.
</para>
</simpara>
</refsect1>
<refsect1 role="parameters">
@@ -25,22 +24,23 @@
<varlistentry>
<term><parameter>prefix</parameter></term>
<listitem>
<para>
<simpara>
Hashing method.
One of CRYPT_PREFIX_* constant, see the <link linkend="xpass.constants">Xpass constants</link> page.
One of the <constant>CRYPT_PREFIX_<replaceable>*</replaceable></constant> constant.
If &null;, the best available hashing method will be selected.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>count</parameter></term>
<listitem>
<para>
Controls the processing cost of the hash; the valid range and exact meaning of count
depend on the hashing method, but larger numbers correspond to more costly hashes in
<simpara>
Controls the processing cost of the hash;
the valid range and exact meaning of count depend on the hashing method,
but larger numbers correspond to more costly hashes in
terms of CPU time and possibly memory usage.
If count is <literal>0</literal>, a low default cost will be selected.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -48,17 +48,16 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string with the setting, or &null; if error.
</para>
<simpara>
Returns a string with the setting, or &null; in case of an error.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>crypt_gensalt</function> example</title>
<programlisting role="php">
<example>
<title>A <function>crypt_gensalt</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Generate the salt
@@ -70,32 +69,28 @@ $test = hash_equals(crypt("secret", $hash), $hash);
var_dump($salt, $hash, $test);
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(29) "$2y$05$GcPykP.Am8C1.dGamdpwW."
string(60) "$2y$05$GcPykP.Am8C1.dGamdpwW.1RR.7uicWvJPZfJfCEizZHqVWwuaJLm"
bool(true)
]]>
</screen>
</example>
</para>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>crypt_preferred_method</function></member>
<member><function>crypt</function></member>
<member><function>hash_equals</function></member>
</simplelist>
</para>
<simplelist>
<member><function>crypt_preferred_method</function></member>
<member><function>crypt</function></member>
<member><function>hash_equals</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.crypt-preferred-method" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>crypt_preferred_method</refname>
@@ -13,9 +12,9 @@
<type class="union"><type>string</type><type>null</type></type><methodname>crypt_preferred_method</methodname>
<void/>
</methodsynopsis>
<para>
<simpara>
Get the prefix of the preferred hash method.
</para>
</simpara>
</refsect1>
<refsect1 role="parameters">
@@ -25,44 +24,39 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string with the prefix, or &null; if error.
</para>
<simpara>
Returns a string with the prefix, or &null; in case of an error.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>crypt_preferred_method</function> example</title>
<programlisting role="php">
<example>
<title>A <function>crypt_preferred_method</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(crypt_preferred_method());
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(3) "$y$"
]]>
</screen>
</example>
</para>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>crypt_gensalt</function></member>
</simplelist>
</para>
<simplelist>
<member><function>crypt_gensalt</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="ref.xpass" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Xpass &Functions;</title>
&reference.xpass.entities.functions;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,28 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="xpass.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.setup;
<section xml:id="xpass.requirements">
&reftitle.required;
<para>
<simpara>
This extension requires
<link xlink:href="https://github.com/besser82/libxcrypt">libxcrypt</link>
version 4.4 or higher.
</para>
<link xlink:href="https://github.com/besser82/libxcrypt">libxcrypt</link>
version 4.4 or higher.
</simpara>
</section>
<section xml:id="xpass.installation">
<title>Installation via PECL</title>
<para>
<simpara>
&pecl.info;
<link xlink:href="&url.pecl.package;xpass">&url.pecl.package;xpass</link>.
</para>
</simpara>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -3,14 +3,12 @@
<!--
Do NOT translate this file
-->
<versions>
<!-- Functions -->
<function name='crypt_gensalt' from='PECL xpass &gt;= 1.1.0'/>
<function name='crypt_preferred_method' from='PECL xpass &gt;= 1.1.0'/>
<function name='crypt_checksalt' from='PECL xpass &gt;= 1.1.0'/>
</versions>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml