PHP encryption note

開始找可用的 PHP 編碼方式,MD5 已經不能在用了,SHA1 目前還好但是不知道以後會不會出問題。


$phrase = "Hello World";

$sha1a = base64_encode(sha1($phrase));
$sha1b = base64_encode(bin2hex(mhash(MHASH_SHA1,$phrase)));
$sha256b= base64_encode(bin2hex(mhash(MHASH_SHA256,$phrase)));

echo ("SHA1..:" . $sha1a . "n");
echo ("SHA1..:" . $sha1b . "n");
echo ("SHA256:" . $sha256b . "n");
?>

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

Exit mobile version