sha1

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

sha1锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷 sha1 散锟斤拷值

Warning

It is not recommended to use this function to secure passwords, due to the fast nature of this hashing algorithm. See the Password Hashing FAQ for details and best practices.

说锟斤拷

sha1 ( string $str [, bool $raw_output = false ] ) : string

锟斤拷锟斤拷» 锟斤拷锟斤拷锟斤拷全散锟斤拷锟姐法 1 锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷 sha1 散锟斤拷值锟斤拷

锟斤拷锟斤拷

str

锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷

raw_output

锟斤拷锟斤拷锟窖★拷锟� raw_output 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷为 TRUE锟斤拷 锟斤拷么 sha1 摘要锟斤拷锟斤拷 20 锟街凤拷锟斤拷锟饺碉拷原始锟斤拷式锟斤拷锟截o拷 锟斤拷锟津返伙拷值锟斤拷一锟斤拷 40 锟街凤拷锟斤拷锟饺碉拷十锟斤拷锟斤拷锟斤拷锟斤拷锟街★拷

锟斤拷锟斤拷值

锟斤拷锟斤拷 sha1 散锟斤拷值锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤拷

Example #1 sha1() 锟斤拷锟斤拷

<?php
$str 
'apple';

if (
sha1($str) === 'd0be2dc421be4fcd0172e5afceea3970e2f3d940') {
    echo 
"Would you like a green or red apple?";
}
?>

锟轿硷拷

  • sha1_file() - 锟斤拷锟斤拷锟侥硷拷锟斤拷 sha1 散锟斤拷值
  • crc32() - 锟斤拷锟斤拷一锟斤拷锟街凤拷锟斤拷锟斤拷 crc32 锟斤拷锟斤拷式
  • md5() - 锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷 MD5 散锟斤拷值
  • hash() - 锟斤拷锟缴癸拷希值 锟斤拷锟斤拷息摘要锟斤拷
  • crypt() - 锟斤拷锟斤拷锟街凤拷锟斤拷散锟斤拷
  • password_hash() - 锟斤拷锟斤拷锟斤拷锟斤拷锟缴拷校锟絟ash锟斤拷