git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@343234 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Andrey Gromov
2017-10-11 21:32:51 +00:00
parent 7790ef59d0
commit d91fb2cf21
6 changed files with 563 additions and 121 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: b90505533de3950c34838bd3715e3e40088c9a05 Maintainer: irker Status: ready -->
<!-- EN-Revision: 5e40a5a43dffadda040c030eaa12d88510a0987c Maintainer: irker Status: ready -->
<!-- Reviewed: yes -->
<!-- $Revision$ -->
@ -271,6 +271,7 @@ echo (new DateTime())->format('Y');
<title>Доступ к свойству vs. вызов метода</title>
<programlisting role="php">
<![CDATA[
<?php
class Foo
{
public $bar = 'property';
@ -303,6 +304,7 @@ method
<title>Вызов анонимной функции содержащейся в свойстве</title>
<programlisting role="php">
<![CDATA[
<?php
class Foo
{
public $bar;

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a2e72b2b3b376d7c852353a511c9a443fbffab6c Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mhash-count" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mhash_count</refname>
<refpurpose>Получить наибольший доступный ID хеша</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>mhash_count</methodname>
<void/>
</methodsynopsis>
<para>
Возвращает наибольший доступный ID хеша.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Получить наибольший доступный идентификатор хеша. Хеши нумеруются от 0 до этого
ID.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Обход всех хэшей</title>
<programlisting role="php">
<![CDATA[
<?php
$nr = mhash_count();
for ($i = 0; $i <= $nr; $i++) {
echo sprintf("The blocksize of %s is %d\n",
mhash_get_hash_name($i),
mhash_get_block_size($i));
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a2e72b2b3b376d7c852353a511c9a443fbffab6c Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mhash-get-block-size" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mhash_get_block_size</refname>
<refpurpose>Получить размер блока для заданного хеша</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>mhash_get_block_size</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
</methodsynopsis>
<para>
Возвращает размер блока для заданного <parameter>hash</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hash</parameter></term>
<listitem>
<para>
ID хеша. Одна из констант <constant>MHASH_hashname</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает размер в байтах или &false;, если параметр <parameter>hash</parameter>
задан некорректно.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>mhash_get_block_size</function></title>
<programlisting role="php">
<![CDATA[
<?php
echo mhash_get_block_size(MHASH_MD5); // 16
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a2e72b2b3b376d7c852353a511c9a443fbffab6c Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mhash-get-hash-name" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mhash_get_hash_name</refname>
<refpurpose>Получить имя указанного хеша</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>mhash_get_hash_name</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
</methodsynopsis>
<para>
Возвращает имя заданного <parameter>hash</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hash</parameter></term>
<listitem>
<para>
ID хеша. Одна из констант <constant>MHASH_hashname</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает строку с названием или &false;, если такого хеша нет.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>mhash_get_hash_name</function></title>
<programlisting role="php">
<![CDATA[
<?php
echo mhash_get_hash_name(MHASH_MD5); // MD5
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a2e72b2b3b376d7c852353a511c9a443fbffab6c Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mhash-keygen-s2k" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mhash_keygen_s2k</refname>
<refpurpose>Генерация ключа</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>mhash_keygen_s2k</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam><type>string</type><parameter>salt</parameter></methodparam>
<methodparam><type>int</type><parameter>bytes</parameter></methodparam>
</methodsynopsis>
<para>
Генерирует ключ в соответствии с заданным <parameter>hash</parameter> и указанным
паролем <parameter>password</parameter>.
</para>
<para>
Используется алгоритм S2K с солью, как описано в документе OpenPGP
(<link xlink:href="&url.rfc;2440">RFC 2440</link>).
</para>
<para>
Помните, что пользовательские пароли не являются подходящими
ключами для криптографических алгоритмов, так как обычно они как минимум
набираемы на клавиатуре. Такие пароли используют только 6-7 бит (или меньше)
на символ. Так что такие пароли крайне рекомендуется предварительно преобразовывать
(например этой функцией).
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hash</parameter></term>
<listitem>
<para>
ID хеша. Одна из констант <constant>MHASH_hashname</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>password</parameter></term>
<listitem>
<para>
Пользовательский пароль.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>salt</parameter></term>
<listitem>
<para>
Должна быть разной и достаточно случайной для каждого создаваемого
ключа. Так как <parameter>salt</parameter> должна быть известна
при проверке ключа, то хорошей идеей будет добавить ее к ключу.
Соль имеет фиксированный размер в 8 байт и будет дополнена нулями, если
заданный параметр будет короче.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>bytes</parameter></term>
<listitem>
<para>
Длина ключа в байтах.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает строку с ключем или &false; в случае ошибки.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a2e72b2b3b376d7c852353a511c9a443fbffab6c Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mhash" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mhash</refname>
<refpurpose>Вычисляет хеш</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>mhash</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
<function>mhash</function> applies a hash function specified by
<parameter>hash</parameter> to the <parameter>data</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hash</parameter></term>
<listitem>
<para>
ID хеша. Одна из констант <constant>MHASH_hashname</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
Строка с пользовательскими данными.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
Если задано, то функция вернет результирующий HMAC.
HMAC - это код аутентификации сообщений, использующий хеш-функции.
Не все алгоритмы поддерживаемые mhash могут быть использованы в
режиме HMAC.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает строку с результирующим хешем или HMAC, или &false; в случае ошибки.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->