File: mhash.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (219 lines) | stat: -rwxr-xr-x 6,415 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?xml version="1.0" encoding="iso-8859-1"?>
 <reference id="ref.mhash">
  <title>Funciones Hash</title>
  <titleabbrev>mhash</titleabbrev>
  
  <partintro>
   <para>
    Estas funciones han sido realizadas para trabajar con <ulink url="&url.mhash;">mhash</ulink>.</para>  

   <para>
    Esta es una interfaz con al libreria mhash. mhash soporta una amplia variedad de algoritmos
    hash como MD5, SHA1, GOST, y muchos otros.</para>

   <para>
    Para usarla, hay que descargar la distribucion desde <ulink url="&url.mhash;"> su sitio web</ulink>  y seguir 
    las intrucciones de instalacion. Se necesita compilar PHP con el parametr <option role="configure">--with-mhash</option>
    para activar esta extension.</para>

   <para>
    mhash puede ser usado para crear checksums, message digests, y mas.</para>
   
   <para>
    <example>
     <title>Generar una clave SHA1 e imprimirla en hexadecimal</title>
     <programlisting role="php">
&lt;?php
$input = "Let us meet at 9 o' clock at the secret place.";
$hash = mhash(MHASH_SHA1, $input);

print "The hash is ".bin2hex($hash)."\n";

?&gt;
     </programlisting>
    </example>

    Esto generara:

    <programlisting>
The hash is d3b85d710d8f6e4e5efd4d5e67d041f9cecedafe
    </programlisting>
	  
    PAra una lista complera de hash soportados, refierase a la documentacion de
    mhash. La regla general es que se puede acceder a los algoritmos hash desde PHP
    con MHASH_HASHNAME. Como ejemplo, para acceder a HAVAL se debe usar la constante
    de PHP llamada MHASH_HAVAL.</para>

   <para>
    Aqui hay una lista de hashes que esta actualmente soportada por mhash. Si un hash
    no esta en dicha lista pero aparece como soportado por mhash, entonces se asume con 
    plena seguridad que esta documentacion esta desfasada.

    <itemizedlist>

     <listitem><simpara>
      MHASH_MD5</simpara></listitem>
     <listitem><simpara>
      MHASH_SHA1</simpara></listitem>
     <listitem><simpara>
      MHASH_HAVAL</simpara></listitem>
     <listitem><simpara>
      MHASH_RIPEMD160</simpara></listitem>
     <listitem><simpara>
      MHASH_RIPEMD128</simpara></listitem>
     <listitem><simpara>
      MHASH_SNEFRU</simpara></listitem>
     <listitem><simpara>
      MHASH_TIGER</simpara></listitem>
     <listitem><simpara>
      MHASH_GOST</simpara></listitem>
     <listitem><simpara>
      MHASH_CRC32</simpara></listitem>
     <listitem><simpara>
      MHASH_CRC32B</simpara></listitem>

    </itemizedlist></para>

  </partintro>
  
  <refentry id="function.mhash-get-hash-name">
   <refnamediv>
    <refname>mhash_get_hash_name</refname>
    <refpurpose>Conseguir el nombre de un hash especifico</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descripcion</title>
     <methodsynopsis>
     <type>string</type><methodname>mhash_get_hash_name</methodname>
     <methodparam><type>int</type><parameter>hash</parameter></methodparam>
     </methodsynopsis>
	
    <para>
     <function>mhash_get_hash_name</function> es usado para conseguir el nombre de
     el hash determinado.</para>

    <para>
     <function>mhash_get_hash_name</function> toma el id del hash como un argumento
     y devuelve el nombre de el hash o &false;, si el hash no existe.</para>
     
    <para>
     <example>
      <title>mhash_get_hash_name example</title>
      <programlisting>
&lt;?php
$hash = MHASH_MD5;

print mhash_get_hash_name($hash);
?&gt;
      </programlisting>
     </example>
	 
     El ejemplo anterior mostrara:
     <programlisting>
MD5
     </programlisting></para>
	
   </refsect1>
  </refentry>
  
  <refentry id="function.mhash-get-block-size">
   <refnamediv>
    <refname>mhash_get_block_size</refname>
    <refpurpose>Conseguir el tama&ntilde;o de bloque de el hash especificado</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descripcion</title>
     <methodsynopsis>
     <type>int</type><methodname>mhash_get_block_size</methodname>
     <methodparam><type>int</type><parameter>hash</parameter></methodparam>
     </methodsynopsis>
	
    <para>
     <function>mhash_get_block_size</function> es usado para obtener el tama&ntilde;o de un
     bloque de el <parameter>hash</parameter> determinado.</para>

    <para>
     <function>mhash_get_block_size</function> toma un argumento, el
     <parameter>hash</parameter> y devuelve el tama&ntilde;o en bytes o &false;, si
     el <parameter>hash</parameter> no existe.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.mhash-count">
   <refnamediv>
    <refname>mhash_count</refname>
    <refpurpose>Obtener el valor mayor del id hash disponible</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descripcion</title>
     <methodsynopsis>
     <type>int</type><methodname>mhash_count</methodname>
     <void/>
     </methodsynopsis>
	
    <para>
     <function>mhash_count</function> devuelve el valor mas alto id hash disponible.
     Los hash estan numerados desde 0 hasta este valor.</para>

    <para>
     <example>
      <title>Recorriendo todos los hash</title>
      <programlisting>
&lt;?php

$nr = mhash_count();

for($i = 0; $i &lt;= $nr; $i++) {
    echo sprintf("The blocksize of %s is %d\n", 
            mhash_get_hash_name($i),
            mhash_get_block_size($i));
}
?&gt;
      </programlisting>
     </example></para>

   </refsect1>
  </refentry>
    
  <refentry id="function.mhash">
   <refnamediv>
    <refname>mhash</refname>
    <refpurpose>Calcular el hash</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descripcion</title>
     <methodsynopsis>
     <type>string</type><methodname>mhash</methodname>
     <methodparam><type>int</type><parameter>hash</parameter></methodparam>
     <methodparam><type>string</type><parameter>data</parameter></methodparam>
     </methodsynopsis>
	
    <para>
     <function>mhash</function> aplica una funcion hash especificada por
     <parameter>hash</parameter> a <parameter>data</parameter> y
     devuelve el valor hash resultante (tambien llamdo digest).</para>
    
   </refsect1>
  </refentry>

 </reference> 

<!-- 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:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->