(PHP 4 >= 4.3.0, PHP 5, PHP 7)
sha1 — �����ַ����� sha1 ɢ��ֵ
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.
$str
[, bool $raw_output
= false
] ) : string����» ������ȫɢ���㷨 1 �����ַ����� sha1 ɢ��ֵ��
str
�����ַ�����
raw_output
�����ѡ�� raw_output
����������Ϊ TRUE
��
��ô sha1 ժҪ���� 20 �ַ����ȵ�ԭʼ��ʽ���أ�
����ֵ��һ�� 40 �ַ����ȵ�ʮ���������֡�
���� sha1 ɢ��ֵ�ַ�����
Example #1 sha1() ����
<?php
$str = 'apple';
if (sha1($str) === 'd0be2dc421be4fcd0172e5afceea3970e2f3d940') {
echo "Would you like a green or red apple?";
}
?>