PHP 系統預設的 Hash 演算法(算 特徵值 用),哪種演算法最快呢?
標籤: hash
PHP 使用 SHA256、SHA512 等 演算法的寫法
PHP 有 md5()、sha1() ... 等等 function,不過現在建議使用 SHA224 以上(註),在 PHP 要怎麼寫呢?
註:下述摘錄自此篇:Mobilefish.com - MD5, SHA1, SHA224, SHA256, SHA384, SHA512 and RIPEMD160 hash generator
- MD5 is considered cryptographically broken and is unsuitable for further use.
- The SHA1 algorithm might not be secure enough for ongoing use. It is recommended not to use SHA1.
- SHA224: SHA224 produces a 224-bit (28-byte) hash value, typically rendered as a hexadecimal number, 56 digits long.
- SHA256: SHA256 produces a 256-bit (32-byte) hash value, typically rendered as a hexadecimal number, 64 digits long.
- SHA384: SHA384 produces a 384-bit (48-byte) hash value, typically rendered as a hexadecimal number, 96 digits long.
- SHA512: SHA512 produces a 512-bit (64-byte) hash value, typically rendered as a hexadecimal number, 128 digits long.
- RIPEMD160: RIPEMD160 produces a 160-bit (20-byte) hash value, typically rendered as a hexadecimal number, 40 digits long.