Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 3102

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>Mhash Functions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Function Reference"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="mcve_void"
HREF="function.mcve-void.html"><LINK
REL="NEXT"
TITLE="mhash_count"
HREF="function.mhash-count.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="reference"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.mcve-void.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.mhash-count.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.mhash"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>LVI. Mhash Functions</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN51358"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="mhash.intro"
></A
>Introduction</H1
><P
>&#13;     These functions are intended to work with <A
HREF="http://mhash.sourceforge.net/"
TARGET="_top"
>mhash</A
>. Mhash can be used to create checksums,
     message digests, message authentication codes, and more.
    </P
><P
>&#13;     This is an interface to the mhash library. mhash supports a wide
     variety of hash algorithms such as MD5, SHA1, GOST, and many
     others. For a complete list of supported hashes, refer to the
     documentation of mhash. The general rule is that you can access
     the hash algorithm from PHP with MHASH_HASHNAME. For example, to
     access TIGER you use the PHP constant MHASH_TIGER.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="mhash.requirements"
></A
>Requirements</H1
><P
>&#13;     To use it, download the mhash distribution from <A
HREF="http://mhash.sourceforge.net/"
TARGET="_top"
>its web site</A
> and follow the included
     installation instructions.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="mhash.installation"
></A
>Installation</H1
><P
>&#13;  You need to compile PHP with the
  <TT
CLASS="option"
>--with-mhash[=DIR]</TT
> parameter to enable
  this extension. DIR is the mhash install directory.
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="mhash.configuration"
></A
>Runtime Configuration</H1
><P
>This extension has no configuration directives defined in <TT
CLASS="filename"
>php.ini</TT
>.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="mhash.resources"
></A
>Resource Types</H1
><P
>This extension has no resource types defined.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="mhash.constants"
></A
>Predefined Constants</H1
><P
>&#13;The constants below are defined by this extension, and
will only be available when the extension has either
been compiled into PHP or dynamically loaded at runtime.
</P
><P
>&#13;  Here is a list of hashes which are currently supported by mhash. If a
  hash is not listed here, but is listed by mhash as supported, you can
  safely assume that this documentation is outdated.
  <P
></P
><UL
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_MD5</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_SHA1</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_HAVAL256</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_HAVAL192</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_HAVAL160</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_HAVAL128</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_RIPEMD160</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_GOST</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_TIGER</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_CRC32</B
></TT
>
    </P
></LI
><LI
><P
>&#13;     <TT
CLASS="constant"
><B
>MHASH_CRC32B</B
></TT
>
    </P
></LI
></UL
>
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="mhash.examples"
></A
>Examples</H1
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN51420"
></A
><P
><B
>Example 1. Compute the MD5 digest and hmac and print it out as hex</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
$input = "what do ya want for nothing?";
$hash = mhash (MHASH_MD5, $input);
print "The hash is ".bin2hex ($hash)."&#60;br /&#62;\n";
$hash = mhash (MHASH_MD5, $input, "Jefe");
print "The hmac is ".bin2hex ($hash)."&#60;br /&#62;\n";
?&#62;</PRE
></TD
></TR
></TABLE
><P
>&#13;       This will produce:
       <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>The hash is d03cb659cbf9192dcd066272249f8412 
The hmac is 750c783e6ab0b503eaa86e310a5db738</PRE
></TD
></TR
></TABLE
>
      </P
></DIV
></TD
></TR
></TABLE
>
    </P
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="function.mhash-count.html"
>mhash_count</A
>&nbsp;--&nbsp;Get the highest available hash id</DT
><DT
><A
HREF="function.mhash-get-block-size.html"
>mhash_get_block_size</A
>&nbsp;--&nbsp;Get the block size of the specified hash</DT
><DT
><A
HREF="function.mhash-get-hash-name.html"
>mhash_get_hash_name</A
>&nbsp;--&nbsp;Get the name of the specified hash</DT
><DT
><A
HREF="function.mhash-keygen-s2k.html"
>mhash_keygen_s2k</A
>&nbsp;--&nbsp;Generates a key</DT
><DT
><A
HREF="function.mhash.html"
>mhash</A
>&nbsp;--&nbsp;Compute hash</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.mcve-void.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.mhash-count.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>mcve_void</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>mhash_count</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>