Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: hash_init - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

hash_update_file" width="11" height="7"/> <hash_hmac
Last updated: Thu, 31 May 2007

view this page in

hash_init

(PHP 5 >= 5.1.2, PECL hash:1.1-1.3)

hash_init — 段階的なハッシュコンテキストを初期化する

説明

resource hash_init ( string $algo [, int $options, string $key] )

パラメータ

algo

選択したアルゴリズムの名前 (すなわち "md5"、"sha256"、"haval160,4" など…)。

options

ハッシュ生成の際に使用するオプションで、現在は、ただひとつ HASH_HMAC のみをサポートしています。これが 指定された場合、key必ず指定しなければなりません。

key

optionsHASH_HMAC が指定された場合に、HMAC 形式のハッシュで使用される共有の秘密鍵を 設定する必要があります。

返り値

hash_update()hash_update_stream()hash_update_file() および hash_final() で使用するハッシュコンテキストリソースを 返します。

例 840. 段階的なハッシュの例

<?php
$ctx
= hash_init('md5');
hash_update($ctx, 'The quick brown fox ');
hash_update($ctx, 'jumped over the lazy dog.');
echo
hash_final($ctx);
?>

上の例の出力は以下となります。


5c6ffbdd40d9556b73a21e63c3e0e904

    

参考

hash()
hash_file()
hash_hmac()
hash_hmac_file()



add a note add a note User Contributed Notes
hash_init
There are no user contributed notes for this page.

hash_update_file" width="11" height="7"/> <hash_hmac
Last updated: Thu, 31 May 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites