首页 > 开发 > PHP > 正文

PHP实现的各类hash算法长度及性能测试实例

2024-05-04 22:45:49
字体:
来源:转载
供稿:网友

本文实例讲述了PHP实现的各类hash算法长度及性能测试。分享给大家供大家参考,具体如下:

Hash结果如下

<?php$data = "hello world";foreach (hash_algos() as $v) {    $r = hash($v, $data, false);    printf("%-12s %3d %s/n", $v, strlen($r), $r);}?>

运行结果:

md2      32 d9cce882ee690a5c1ce70beff3a78c77md4      32 aa010fbc1d14c795d86ef98c95479d17md5      32 5eb63bbbe01eeed093cb22bb8f5acdc3sha1     40 2aae6c35c94fcfb415dbe95f408b9ce91ee846edsha224    56 2f05477fc24bb4faefd86517156dafdecec45b8ad3cf2522a563582bsha256    64 b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9sha384    96 fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bdsha512    128 309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76fripemd128   32 c52ac4d06245286b33953957be6c6f81ripemd160   40 98c615784ccb5fe5936fbc0cbe9dfdb408d92f0fripemd256   64 0d375cf9d9ee95a3bb15f757c81e93bb0ad963edf69dc4d12264031814608e37ripemd320   80 0e12fe7d075f8e319e07c106917eddb0135e9a10aefb50a8a07ccb0582ff1fa27b95ed5af57fd5c6whirlpool  128 8d8309ca6af848095bcabaf9a53b1b6ce7f594c1434fd6e5177e7e5c20e76cd30936d8606e7f36acbef8978fea008e6400a975d51abe6ba4923178c7cf90c802tiger128,3  32 4c8fbddae0b6f25832af45e7c62811bbtiger160,3  40 4c8fbddae0b6f25832af45e7c62811bb64ec3e43tiger192,3  48 4c8fbddae0b6f25832af45e7c62811bb64ec3e43691e9cc3tiger128,4  32 24465a3f6e4aa92d903ee535476591e9tiger160,4  40 24465a3f6e4aa92d903ee535476591e937f3a14dtiger192,4  48 24465a3f6e4aa92d903ee535476591e937f3a14d81c4c7b6snefru    64 902b49fa8b0828b44d8ac069111899bbfaf51d334485e4b28e90c93f63bb86ddsnefru256   64 902b49fa8b0828b44d8ac069111899bbfaf51d334485e4b28e90c93f63bb86ddgost     64 1bb6ce69d2e895a78489c87a0712a2f40258d1fae3a4666c23f8f487bef0e22agost-crypto  64 c5aa1455afe9f0c440eec3c96ccccb5c8495097572cc0f625278bd0da5ea5e07adler32    8 1a0b045dcrc32     8 7813f744crc32b     8 0d4a1185fnv132     8 548da96ffnv1a32    8 d58b3fa7fnv164    16 7dcf62cdb1910e6ffnv1a64    16 779a65e7023cd2e7joaat     8 3e4a5a57haval128,3  32 906c1df7cbe6d318f36ab172f95e89c0haval160,3  40 6e733b21876e47c2168a122e23d86bdd69e50f95haval192,3  48 ec67a6a417953fdbf3496502004b6c21b270d5890dedd931haval224,3  56 766879d9ba1dc9e24a6040908a7ae813a47b08af5c5f3beebcacda48haval256,3  64 45492c6c8adab277759f4381420799431a037daf6d829b8b5c21104c10f61a92haval128,4  32 c97d46956b8e3e60acd2bb090c482c5ehaval160,4  40 2cb8b12eb5a2561022010c2a2af8795e602fdef2haval192,4  48 39a281e4e492533b6dfea0af294149ccac771ab87204c9echaval224,4  56 3d64d34aea48f5e649ed6147da5d29d31c762a937e9e21f4da1f3106haval256,4  64 0359a526d77e271707c44d9b270e68a394f8486a459f0137ad5e1d02e44c5889haval128,5  32 8332ad9f32e385d9acd421b63ee04cfchaval160,5  40 d33cf9052d55da9b0f506cb8849097939363e361haval192,5  48 67c3492878c8fc4819c8589231fcfe69b15b015c1ca48ac5haval224,5  56 6bedeb6a8676e46413c020c8813c022486ca93353b8a0673fb577ba1haval256,5  64 f5f6ffcfe39a65ac2c3989430340420341762a6624ebd69b9d08ec1dc4b9f167            
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表