Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 2550

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>mhash_keygen_s2k</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Mhash Functions"
HREF="ref.mhash.html"><LINK
REL="PREVIOUS"
TITLE="mhash_get_hash_name"
HREF="function.mhash-get-hash-name.html"><LINK
REL="NEXT"
TITLE="mhash"
HREF="function.mhash.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
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 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.mhash-get-hash-name.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.mhash.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.mhash-keygen-s2k"
></A
>mhash_keygen_s2k</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN119119"
></A
><P
>    (PHP 4 &#62;= 4.0.4, PHP 5)</P
>mhash_keygen_s2k&nbsp;--&nbsp;Generates a key</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN119122"
></A
><H2
>说明</H2
>string <B
CLASS="methodname"
>mhash_keygen_s2k</B
> ( int hash, string password, string salt, int bytes )<BR
></BR
><P
>&#13;   Generates a key according to the <CODE
CLASS="parameter"
>hash</CODE
> given a user
   provided <CODE
CLASS="parameter"
>password</CODE
>.
  </P
><P
>&#13;   This is the Salted S2K algorithm as specified in the OpenPGP
   document (<A
HREF="http://www.faqs.org/rfcs/rfc2440"
TARGET="_top"
>RFC 2440</A
>).
  </P
><P
>&#13;   Keep in mind that user supplied passwords are not really suitable
   to be used as keys in cryptographic algorithms, since users normally
   choose keys they can write on keyboard. These passwords use
   only 6 to 7 bits per character (or less). It is highly recommended
   to use some kind of transformation (like this function) to the user
   supplied key.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN119145"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>hash</CODE
></DT
><DD
><P
>&#13;       The hash id used to create the key.
       One of the <TT
CLASS="literal"
>MHASH_XXX</TT
> constants.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>password</CODE
></DT
><DD
><P
>&#13;       User supplied password.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>salt</CODE
></DT
><DD
><P
>&#13;       Must be different and random enough for every key you generate in
       order to create different keys. That salt must be known when you check
       the keys, thus it is a good idea to append the key to it. Salt has a
       fixed length of 8 bytes and will be padded with zeros if you supply
       less bytes.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>bytes</CODE
></DT
><DD
><P
>&#13;       The key length, in bytes.
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN119170"
></A
><H2
>返回值</H2
><P
>&#13;   Returns the generated key as a string, or <TT
CLASS="constant"
><B
>FALSE</B
></TT
> on error.
  </P
></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.mhash-get-hash-name.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.mhash.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>mhash_get_hash_name</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.mhash.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>mhash</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>