当前位置 : 主页 > 网络编程 > PHP >

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

来源:互联网 收集:自由互联 发布时间:2021-06-30
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,
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网址吧!

1. [代码][PHP]代码    

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;
}

2. [图片] 未命名.png    

网友评论