hash_file

(PHP 5 >= 5.1.2, PHP 7, PECL hash >= 1.1)

hash_file使锟矫革拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟缴癸拷希值

说锟斤拷

hash_file ( string $algo , string $filename [, bool $raw_output = FALSE ] ) : string

锟斤拷锟斤拷

algo

要使锟矫的癸拷希锟姐法锟斤拷锟斤拷锟狡o拷锟斤拷锟界:"md5"锟斤拷"sha256"锟斤拷"haval160,4" 锟饺★拷

filename

要锟斤拷锟叫癸拷希锟斤拷锟斤拷锟斤拷募锟铰凤拷锟斤拷锟街э拷锟� fopen 锟斤拷装锟斤拷锟斤拷

raw_output

锟斤拷锟斤拷为 TRUE锟斤拷锟斤拷锟斤拷锟绞轿硷拷亩锟斤拷锟斤拷锟斤拷锟斤拷荨锟� 锟斤拷锟斤拷为 FALSE锟斤拷锟斤拷锟叫⌒达拷锟� 16 锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤拷值

锟斤拷锟� raw_output 锟斤拷锟斤拷为 TRUE锟斤拷 锟津返伙拷原始锟斤拷锟斤拷锟斤拷锟斤拷锟捷憋拷示锟斤拷锟斤拷息摘要锟斤拷 锟斤拷锟津返伙拷 16 锟斤拷锟斤拷小写锟街凤拷锟斤拷锟斤拷式锟斤拷示锟斤拷锟斤拷息摘要锟斤拷

锟斤拷锟斤拷

Example #1 使锟斤拷 hash_file()

<?php
/* 锟斤拷锟斤拷一锟斤拷要锟斤拷锟斤拷锟较V碉拷锟斤拷募锟� */
file_put_contents('example.txt''The quick brown fox jumped over the lazy dog.');

echo 
hash_file('md5''example.txt');
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

5c6ffbdd40d9556b73a21e63c3e0e904

锟轿硷拷

  • hash() - 锟斤拷锟缴癸拷希值 锟斤拷锟斤拷息摘要锟斤拷
  • hash_hmac_file() - 使锟斤拷 HMAC 锟斤拷锟斤拷锟酵革拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟缴达拷锟斤拷钥锟侥癸拷希值
  • hash_update_file() - 锟斤拷锟侥硷拷锟斤拷锟皆撅拷墓锟较o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
  • md5_file() - 锟斤拷锟斤拷指锟斤拷锟侥硷拷锟斤拷 MD5 散锟斤拷值
  • sha1_file() - 锟斤拷锟斤拷锟侥硷拷锟斤拷 sha1 散锟斤拷值