sha1

(PHP 4 >= 4.3.0, PHP 5)

sha1 -- 문자열의 sha1 해쉬를 계산합니다.

설명

string sha1 ( string str [, bool raw_output])

US Secure Hash Algorithm 1을 사용하여, str의 sha1 해쉬를 계산하여 반환합니다. 해쉬는 16진수를 나타내는 40 문자입니다. 선택적인 raw_outputTRUE로 설정하면, 길이 20인 무변환 바이너리 형식의 sha1 다이제스트를 반환합니다.

참고: 선택적인 raw_output 인자는 PHP 5.0.0에서 추가되었고, 기본값은 FALSE입니다.

예 1. sha1() 예제

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

참고: sha1_file(), crc32(), md5()