欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

计算文本的各种Hash加密,超级全面

程序员文章站 2022-05-05 14:56:19
...

DEMO演示:http://dighash.com/ 全站代码:https://github.com/hustcc/dig_hash,求star hash算法包括:md2,md4,md5,sha1,sha224,sha256,sha384,sha512,ripemd128,ripemd160,ripemd256,ripemd320,whirlpool,tiger128_3,tiger160_3,tiger192_3,tiger128_4,tig

DEMO演示:http://dighash.com/

全站代码:https://github.com/hustcc/dig_hash ,求star

hash算法 包括:md2,md4,md5,sha1,sha224,sha256,sha384,sha512,ripemd128,ripemd160,ripemd256,ripemd320,whirlpool,tiger128_3,tiger160_3,tiger192_3,tiger128_4,tiger160_4,tiger192_4,snefru,snefru256,gost,gost-crypto,adler32,crc32,crc32b,fnv132,fnv1a32,fnv164,fnv1a64,joaat,haval128_3,haval160_3,haval192_3,haval224_3,haval256_3,haval128_4,haval160_4,haval192_4,haval224_4,haval256_4,haval128_5,haval160_5,haval192_5,haval224_5,haval256_5

看晕了吧,直接看上面的demo网址吧!

function cal_hash($chars) {
    $algos = hash_algos();
    $hash_rst = array();
    foreach($algos as $algo) {
        $st = microtime();
        $rst = hash($algo, $chars, false);
        $et = microtime();
        list($ss, $si) = explode(' ', $st);
        list($es, $ei) = explode(' ', $et);
        $hash_rst[str_replace(",", "_", $algo)] = array('rst' => $rst, 'time' => $ei + $es - $si - $ss);
    }
    return $hash_rst;
}

计算文本的各种Hash加密,超级全面