import zend hash tests

not bad. >50%
Esse commit está contido em:
Paul Tarjan
2013-04-22 18:17:40 -07:00
commit de Sara Golemon
commit ad74e1f391
79 arquivos alterados com 1838 adições e 1 exclusões
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
echo hash('adler32', ''), "\n";
echo hash('adler32', 'a'), "\n";
echo hash('adler32', 'abc'), "\n";
echo hash('adler32', 'message digest'), "\n";
echo hash('adler32', 'abcdefghijklmnopqrstuvwxyz'), "\n";
echo hash('adler32', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), "\n";
echo hash('adler32', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'), "\n";
?>
@@ -0,0 +1,7 @@
00000001
00620062
024d0127
29750586
90860b20
8adb150c
97b61069
+10
Ver Arquivo
@@ -0,0 +1,10 @@
<?php
$h = hash_init('crc32b', HASH_HMAC, '123456' );
$h2 = hash_copy($h);
var_dump(hash_final($h));
$h3 = hash_copy($h2);
var_dump(hash_final($h2));
var_dump(hash_final($h3));
?>
@@ -0,0 +1,3 @@
string(8) "278af264"
string(8) "278af264"
string(8) "278af264"
+16
Ver Arquivo
@@ -0,0 +1,16 @@
<?php
echo hash('crc32', ''), "\n";
echo hash('crc32', 'a'), "\n";
echo hash('crc32', 'abc'), "\n";
echo hash('crc32', 'message digest'), "\n";
echo hash('crc32', 'abcdefghijklmnopqrstuvwxyz'), "\n";
echo hash('crc32', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), "\n";
echo hash('crc32', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'), "\n";
echo hash('crc32b', ''), "\n";
echo hash('crc32b', 'a'), "\n";
echo hash('crc32b', 'abc'), "\n";
echo hash('crc32b', 'message digest'), "\n";
echo hash('crc32b', 'abcdefghijklmnopqrstuvwxyz'), "\n";
echo hash('crc32b', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), "\n";
echo hash('crc32b', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'), "\n";
?>
@@ -0,0 +1,14 @@
00000000
6b9b9319
73bb8c64
5703c9bf
9693bf77
882174a0
96790816
00000000
e8b7be43
352441c2
20159d7f
4c2750bd
1fc2e6d2
7ca94a72
+195
Ver Arquivo
@@ -0,0 +1,195 @@
<?php
function R10($t) {
return str_repeat($t, 10);
}
function R500($t) {
return str_repeat($t, 500);
}
$tests = array(
array( "", "811c9dc5" ),
array( "a", "050c5d7e" ),
array( "b", "050c5d7d" ),
array( "c", "050c5d7c" ),
array( "d", "050c5d7b" ),
array( "e", "050c5d7a" ),
array( "f", "050c5d79" ),
array( "fo", "6b772514" ),
array( "foo", "408f5e13" ),
array( "foob", "b4b1178b" ),
array( "fooba", "fdc80fb0" ),
array( "foobar", "31f0b262" ),
array( "\0", "050c5d1f" ),
array( "a\0", "70772d5a" ),
array( "b\0", "6f772bc7" ),
array( "c\0", "6e772a34" ),
array( "d\0", "6d7728a1" ),
array( "e\0", "6c77270e" ),
array( "f\0", "6b77257b" ),
array( "fo\0", "408f5e7c" ),
array( "foo\0", "b4b117e9" ),
array( "foob\0", "fdc80fd1" ),
array( "fooba\0", "31f0b210" ),
array( "foobar\0", "ffe8d046" ),
array( "ch", "6e772a5c" ),
array( "cho", "4197aebb" ),
array( "chon", "fcc8100f" ),
array( "chong", "fdf147fa" ),
array( "chongo", "bcd44ee1" ),
array( "chongo ", "23382c13" ),
array( "chongo w", "846d619e" ),
array( "chongo wa", "1630abdb" ),
array( "chongo was", "c99e89b2" ),
array( "chongo was ", "1692c316" ),
array( "chongo was h", "9f091bca" ),
array( "chongo was he", "2556be9b" ),
array( "chongo was her", "628e0e73" ),
array( "chongo was here", "98a0bf6c" ),
array( "chongo was here!", "b10d5725" ),
array( "chongo was here!\n", "dd002f35" ),
array( "ch\0", "4197aed4" ),
array( "cho\0", "fcc81061" ),
array( "chon\0", "fdf1479d" ),
array( "chong\0", "bcd44e8e" ),
array( "chongo\0", "23382c33" ),
array( "chongo \0", "846d61e9" ),
array( "chongo w\0", "1630abba" ),
array( "chongo wa\0", "c99e89c1" ),
array( "chongo was\0", "1692c336" ),
array( "chongo was \0", "9f091ba2" ),
array( "chongo was h\0", "2556befe" ),
array( "chongo was he\0", "628e0e01" ),
array( "chongo was her\0", "98a0bf09" ),
array( "chongo was here\0", "b10d5704" ),
array( "chongo was here!\0", "dd002f3f" ),
array( "chongo was here!\n\0", "1c4a506f" ),
array( "cu", "6e772a41" ),
array( "cur", "26978421" ),
array( "curd", "e184ff97" ),
array( "curds", "9b5e5ac6" ),
array( "curds ", "5b88e592" ),
array( "curds a", "aa8164b7" ),
array( "curds an", "20b18c7b" ),
array( "curds and", "f28025c5" ),
array( "curds and ", "84bb753f" ),
array( "curds and w", "3219925a" ),
array( "curds and wh", "384163c6" ),
array( "curds and whe", "54f010d7" ),
array( "curds and whey", "8cea820c" ),
array( "curds and whey\n", "e12ab8ee" ),
array( "cu\0", "26978453" ),
array( "cur\0", "e184fff3" ),
array( "curd\0", "9b5e5ab5" ),
array( "curds\0", "5b88e5b2" ),
array( "curds \0", "aa8164d6" ),
array( "curds a\0", "20b18c15" ),
array( "curds an\0", "f28025a1" ),
array( "curds and\0", "84bb751f" ),
array( "curds and \0", "3219922d" ),
array( "curds and w\0", "384163ae" ),
array( "curds and wh\0", "54f010b2" ),
array( "curds and whe\0", "8cea8275" ),
array( "curds and whey\0", "e12ab8e4" ),
array( "curds and whey\n\0", "64411eaa" ),
array( "line 1\nline 2\nline 3", "31ae8f83" ),
array( "chongo <Landon Curt Noll> /\\../\\", "995fa9c4" ),
array( "chongo <Landon Curt Noll> /\\../\\\0", "35983f8c" ),
array( "chongo (Landon Curt Noll) /\\../\\", "5036a251" ),
array( "chongo (Landon Curt Noll) /\\../\\\0", "97018583" ),
array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "b4448d60" ),
array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "025dfe59" ),
array( "http://epod.usra.edu/", "c5eab3af" ),
array( "http://exoplanet.eu/", "7d21ba1e" ),
array( "http://hvo.wr.usgs.gov/cam3/", "7704cddb" ),
array( "http://hvo.wr.usgs.gov/cams/HMcam/", "d0071bfe" ),
array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "0ff3774c" ),
array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "b0fea0ea" ),
array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "58177303" ),
array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "4f599cda" ),
array( "http://neo.jpl.nasa.gov/risk/", "3e590a47" ),
array( "http://norvig.com/21-days.html", "965595f8" ),
array( "http://primes.utm.edu/curios/home.php", "c37f178d" ),
array( "http://slashdot.org/", "9711dd26" ),
array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "23c99b7f" ),
array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "6e568b17" ),
array( "http://www.avo.alaska.edu/activity/Redoubt.php", "43f0245b" ),
array( "http://www.dilbert.com/fast/", "bcb7a001" ),
array( "http://www.fourmilab.ch/gravitation/orbits/", "12e6dffe" ),
array( "http://www.fpoa.net/", "0792f2d6" ),
array( "http://www.ioccc.org/index.html", "b966936b" ),
array( "http://www.isthe.com/cgi-bin/number.cgi", "46439ac5" ),
array( "http://www.isthe.com/chongo/bio.html", "728d49af" ),
array( "http://www.isthe.com/chongo/index.html", "d33745c9" ),
array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "bc382a57" ),
array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "4bda1d31" ),
array( "http://www.isthe.com/chongo/tech/astro/vita.html", "ce35ccae" ),
array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "3b6eed94" ),
array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "445c9c58" ),
array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "3db8bf9d" ),
array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "2dee116d" ),
array( "http://www.isthe.com/chongo/tech/math/number/number.html", "c18738da" ),
array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "5b156176" ),
array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "2aa7d593" ),
array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "b2409658" ),
array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "e1489528" ),
array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "fe1ee07e" ),
array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "e8842315" ),
array( "http://www.lavarnd.org/index.html", "3a6a63a2" ),
array( "http://www.lavarnd.org/what/nist-test.html", "06d2c18c" ),
array( "http://www.macosxhints.com/", "f8ef7225" ),
array( "http://www.mellis.com/", "843d3300" ),
array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "bb24f7ae" ),
array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "878c0ec9" ),
array( "http://www.paulnoll.com/", "b557810f" ),
array( "http://www.pepysdiary.com/", "57423246" ),
array( "http://www.sciencenews.org/index/home/activity/view", "87f7505e" ),
array( "http://www.skyandtelescope.com/", "bb809f20" ),
array( "http://www.sput.nl/~rob/sirius.html", "8932abb5" ),
array( "http://www.systemexperts.com/", "0a9b3aa0" ),
array( "http://www.tq-international.com/phpBB3/index.php", "b8682a24" ),
array( "http://www.travelquesttours.com/index.htm", "a7ac1c56" ),
array( "http://www.wunderground.com/global/stations/89606.html", "11409252" ),
array( R10("21701"), "a987f517" ),
array( R10("M21701"), "f309e7ed" ),
array( R10("2^21701-1"), "c9e8f417" ),
array( R10("\x54\xc5"), "7f447bdd" ),
array( R10("\xc5\x54"), "b929adc5" ),
array( R10("23209"), "57022879" ),
array( R10("M23209"), "dcfd2c49" ),
array( R10("2^23209-1"), "6edafff5" ),
array( R10("\x5a\xa9"), "f04fb1f1" ),
array( R10("\xa9\x5a"), "fb7de8b9" ),
array( R10("391581216093"), "c5f1d7e9" ),
array( R10("391581*2^216093-1"), "32c1f439" ),
array( R10("\x05\xf9\x9d\x03\x4c\x81"), "7fd3eb7d" ),
array( R10("FEDCBA9876543210"), "81597da5" ),
array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "05eb7a25" ),
array( R10("EFCDAB8967452301"), "9c0fa1b5" ),
array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "53ccb1c5" ),
array( R10("0123456789ABCDEF"), "fabece15" ),
array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "4ad745a5" ),
array( R10("1032547698BADCFE"), "e5bdc495" ),
array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "23b3c0a5" ),
array( R500("\x00"), "fa823dd5" ),
array( R500("\x07"), "0c6c58b9" ),
array( R500("~"), "e2dbccd5" ),
array( R500("\x7f"), "db7f50f9" ),
);
$i = 0;
$pass = true;
foreach($tests as $test) {
$result = hash('fnv132', $test[0]);
if ($result != $test[1]) {
echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
$pass = false;
}
$i++;
}
if($pass) {
echo "PASS";
}
?>
@@ -0,0 +1 @@
PASS
+195
Ver Arquivo
@@ -0,0 +1,195 @@
<?php
function R10($t) {
return str_repeat($t, 10);
}
function R500($t) {
return str_repeat($t, 500);
}
$tests = array(
array( "", "cbf29ce484222325" ),
array( "a", "af63bd4c8601b7be" ),
array( "b", "af63bd4c8601b7bd" ),
array( "c", "af63bd4c8601b7bc" ),
array( "d", "af63bd4c8601b7bb" ),
array( "e", "af63bd4c8601b7ba" ),
array( "f", "af63bd4c8601b7b9" ),
array( "fo", "08326207b4eb2f34" ),
array( "foo", "d8cbc7186ba13533" ),
array( "foob", "0378817ee2ed65cb" ),
array( "fooba", "d329d59b9963f790" ),
array( "foobar", "340d8765a4dda9c2" ),
array( "\0", "af63bd4c8601b7df" ),
array( "a\0", "08326707b4eb37da" ),
array( "b\0", "08326607b4eb3627" ),
array( "c\0", "08326507b4eb3474" ),
array( "d\0", "08326407b4eb32c1" ),
array( "e\0", "08326307b4eb310e" ),
array( "f\0", "08326207b4eb2f5b" ),
array( "fo\0", "d8cbc7186ba1355c" ),
array( "foo\0", "0378817ee2ed65a9" ),
array( "foob\0", "d329d59b9963f7f1" ),
array( "fooba\0", "340d8765a4dda9b0" ),
array( "foobar\0", "50a6d3b724a774a6" ),
array( "ch", "08326507b4eb341c" ),
array( "cho", "d8d5c8186ba98bfb" ),
array( "chon", "1ccefc7ef118dbef" ),
array( "chong", "0c92fab3ad3db77a" ),
array( "chongo", "9b77794f5fdec421" ),
array( "chongo ", "0ac742dfe7874433" ),
array( "chongo w", "d7dad5766ad8e2de" ),
array( "chongo wa", "a1bb96378e897f5b" ),
array( "chongo was", "5b3f9b6733a367d2" ),
array( "chongo was ", "b07ce25cbea969f6" ),
array( "chongo was h", "8d9e9997f9df0d6a" ),
array( "chongo was he", "838c673d9603cb7b" ),
array( "chongo was her", "8b5ee8a5e872c273" ),
array( "chongo was here", "4507c4e9fb00690c" ),
array( "chongo was here!", "4c9ca59581b27f45" ),
array( "chongo was here!\n", "e0aca20b624e4235" ),
array( "ch\0", "d8d5c8186ba98b94" ),
array( "cho\0", "1ccefc7ef118db81" ),
array( "chon\0", "0c92fab3ad3db71d" ),
array( "chong\0", "9b77794f5fdec44e" ),
array( "chongo\0", "0ac742dfe7874413" ),
array( "chongo \0", "d7dad5766ad8e2a9" ),
array( "chongo w\0", "a1bb96378e897f3a" ),
array( "chongo wa\0", "5b3f9b6733a367a1" ),
array( "chongo was\0", "b07ce25cbea969d6" ),
array( "chongo was \0", "8d9e9997f9df0d02" ),
array( "chongo was h\0", "838c673d9603cb1e" ),
array( "chongo was he\0", "8b5ee8a5e872c201" ),
array( "chongo was her\0", "4507c4e9fb006969" ),
array( "chongo was here\0", "4c9ca59581b27f64" ),
array( "chongo was here!\0", "e0aca20b624e423f" ),
array( "chongo was here!\n\0", "13998e580afa800f" ),
array( "cu", "08326507b4eb3401" ),
array( "cur", "d8d5ad186ba95dc1" ),
array( "curd", "1c72e17ef0ca4e97" ),
array( "curds", "2183c1b327c38ae6" ),
array( "curds ", "b66d096c914504f2" ),
array( "curds a", "404bf57ad8476757" ),
array( "curds an", "887976bd815498bb" ),
array( "curds and", "3afd7f02c2bf85a5" ),
array( "curds and ", "fc4476b0eb70177f" ),
array( "curds and w", "186d2da00f77ecba" ),
array( "curds and wh", "f97140fa48c74066" ),
array( "curds and whe", "a2b1cf49aa926d37" ),
array( "curds and whey", "0690712cd6cf940c" ),
array( "curds and whey\n", "f7045b3102b8906e" ),
array( "cu\0", "d8d5ad186ba95db3" ),
array( "cur\0", "1c72e17ef0ca4ef3" ),
array( "curd\0", "2183c1b327c38a95" ),
array( "curds\0", "b66d096c914504d2" ),
array( "curds \0", "404bf57ad8476736" ),
array( "curds a\0", "887976bd815498d5" ),
array( "curds an\0", "3afd7f02c2bf85c1" ),
array( "curds and\0", "fc4476b0eb70175f" ),
array( "curds and \0", "186d2da00f77eccd" ),
array( "curds and w\0", "f97140fa48c7400e" ),
array( "curds and wh\0", "a2b1cf49aa926d52" ),
array( "curds and whe\0", "0690712cd6cf9475" ),
array( "curds and whey\0", "f7045b3102b89064" ),
array( "curds and whey\n\0", "74f762479f9d6aea" ),
array( "line 1\nline 2\nline 3", "a64e5f36c9e2b0e3" ),
array( "chongo <Landon Curt Noll> /\\../\\", "8fd0680da3088a04" ),
array( "chongo <Landon Curt Noll> /\\../\\\0", "67aad32c078284cc" ),
array( "chongo (Landon Curt Noll) /\\../\\", "b37d55d81c57b331" ),
array( "chongo (Landon Curt Noll) /\\../\\\0", "55ac0f3829057c43" ),
array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "cb27f4b8e1b6cc20" ),
array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "26caf88bcbef2d19" ),
array( "http://epod.usra.edu/", "8e6e063b97e61b8f" ),
array( "http://exoplanet.eu/", "b42750f7f3b7c37e" ),
array( "http://hvo.wr.usgs.gov/cam3/", "f3c6ba64cf7ca99b" ),
array( "http://hvo.wr.usgs.gov/cams/HMcam/", "ebfb69b427ea80fe" ),
array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "39b50c3ed970f46c" ),
array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "5b9b177aa3eb3e8a" ),
array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "6510063ecf4ec903" ),
array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "2b3bbd2c00797c7a" ),
array( "http://neo.jpl.nasa.gov/risk/", "f1d6204ff5cb4aa7" ),
array( "http://norvig.com/21-days.html", "4836e27ccf099f38" ),
array( "http://primes.utm.edu/curios/home.php", "82efbb0dd073b44d" ),
array( "http://slashdot.org/", "4a80c282ffd7d4c6" ),
array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "305d1a9c9ee43bdf" ),
array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "15c366948ffc6997" ),
array( "http://www.avo.alaska.edu/activity/Redoubt.php", "80153ae218916e7b" ),
array( "http://www.dilbert.com/fast/", "fa23e2bdf9e2a9e1" ),
array( "http://www.fourmilab.ch/gravitation/orbits/", "d47e8d8a2333c6de" ),
array( "http://www.fpoa.net/", "7e128095f688b056" ),
array( "http://www.ioccc.org/index.html", "2f5356890efcedab" ),
array( "http://www.isthe.com/cgi-bin/number.cgi", "95c2b383014f55c5" ),
array( "http://www.isthe.com/chongo/bio.html", "4727a5339ce6070f" ),
array( "http://www.isthe.com/chongo/index.html", "b0555ecd575108e9" ),
array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "48d785770bb4af37" ),
array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "09d4701c12af02b1" ),
array( "http://www.isthe.com/chongo/tech/astro/vita.html", "79f031e78f3cf62e" ),
array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "52a1ee85db1b5a94" ),
array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "6bd95b2eb37fa6b8" ),
array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "74971b7077aef85d" ),
array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "b4e4fae2ffcc1aad" ),
array( "http://www.isthe.com/chongo/tech/math/number/number.html", "2bd48bd898b8f63a" ),
array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "e9966ac1556257f6" ),
array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "92a3d1cd078ba293" ),
array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "f81175a482e20ab8" ),
array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "5bbb3de722e73048" ),
array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "6b4f363492b9f2be" ),
array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "c2d559df73d59875" ),
array( "http://www.lavarnd.org/index.html", "f75f62284bc7a8c2" ),
array( "http://www.lavarnd.org/what/nist-test.html", "da8dd8e116a9f1cc" ),
array( "http://www.macosxhints.com/", "bdc1e6ab76057885" ),
array( "http://www.mellis.com/", "fec6a4238a1224a0" ),
array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "c03f40f3223e290e" ),
array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "1ed21673466ffda9" ),
array( "http://www.paulnoll.com/", "df70f906bb0dd2af" ),
array( "http://www.pepysdiary.com/", "f3dcda369f2af666" ),
array( "http://www.sciencenews.org/index/home/activity/view", "9ebb11573cdcebde" ),
array( "http://www.skyandtelescope.com/", "81c72d9077fedca0" ),
array( "http://www.sput.nl/~rob/sirius.html", "0ec074a31be5fb15" ),
array( "http://www.systemexperts.com/", "2a8b3280b6c48f20" ),
array( "http://www.tq-international.com/phpBB3/index.php", "fd31777513309344" ),
array( "http://www.travelquesttours.com/index.htm", "194534a86ad006b6" ),
array( "http://www.wunderground.com/global/stations/89606.html", "3be6fdf46e0cfe12" ),
array( R10("21701"), "017cc137a07eb057" ),
array( R10("M21701"), "9428fc6e7d26b54d" ),
array( R10("2^21701-1"), "9aaa2e3603ef8ad7" ),
array( R10("\x54\xc5"), "82c6d3f3a0ccdf7d" ),
array( R10("\xc5\x54"), "c86eeea00cf09b65" ),
array( R10("23209"), "705f8189dbb58299" ),
array( R10("M23209"), "415a7f554391ca69" ),
array( R10("2^23209-1"), "cfe3d49fa2bdc555" ),
array( R10("\x5a\xa9"), "f0f9c56039b25191" ),
array( R10("\xa9\x5a"), "7075cb6abd1d32d9" ),
array( R10("391581216093"), "43c94e2c8b277509" ),
array( R10("391581*2^216093-1"), "3cbfd4e4ea670359" ),
array( R10("\x05\xf9\x9d\x03\x4c\x81"), "c05887810f4d019d" ),
array( R10("FEDCBA9876543210"), "14468ff93ac22dc5" ),
array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "ebed699589d99c05" ),
array( R10("EFCDAB8967452301"), "6d99f6df321ca5d5" ),
array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "0cd410d08c36d625" ),
array( R10("0123456789ABCDEF"), "ef1b2a2c86831d35" ),
array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "3b349c4d69ee5f05" ),
array( R10("1032547698BADCFE"), "55248ce88f45f035" ),
array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "aa69ca6a18a4c885" ),
array( R500("\x00"), "1fe3fce62bd816b5" ),
array( R500("\x07"), "0289a488a8df69d9" ),
array( R500("~"), "15e96e1613df98b5" ),
array( R500("\x7f"), "e6be57375ad89b99" ),
);
$i = 0;
$pass = true;
foreach($tests as $test) {
$result = hash('fnv164', $test[0]);
if ($result != $test[1]) {
echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
$pass = false;
}
$i++;
}
if($pass) {
echo "PASS";
}
?>
@@ -0,0 +1 @@
PASS
+13
Ver Arquivo
@@ -0,0 +1,13 @@
<?php
/* Prototype : array hash_algos (void)
* Description: Return a list of registered hashing algorithms
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash_algos() : basic functionality ***\n";
var_dump(hash_algos());
?>
===Done===
@@ -0,0 +1,90 @@
*** Testing hash_algos() : basic functionality ***
array(43) {
[%d]=>
string(3) "md2"
[%d]=>
string(3) "md4"
[%d]=>
string(3) "md5"
[%d]=>
string(4) "sha1"
[%d]=>
string(6) "sha224"
[%d]=>
string(6) "sha256"
[%d]=>
string(6) "sha384"
[%d]=>
string(6) "sha512"
[%d]=>
string(9) "ripemd128"
[%d]=>
string(9) "ripemd160"
[%d]=>
string(9) "ripemd256"
[%d]=>
string(9) "ripemd320"
[%d]=>
string(9) "whirlpool"
[%d]=>
string(10) "tiger128,3"
[%d]=>
string(10) "tiger160,3"
[%d]=>
string(10) "tiger192,3"
[%d]=>
string(10) "tiger128,4"
[%d]=>
string(10) "tiger160,4"
[%d]=>
string(10) "tiger192,4"
[%d]=>
string(6) "snefru"
[%d]=>
string(9) "snefru256"
[%d]=>
string(4) "gost"
[%d]=>
string(7) "adler32"
[%d]=>
string(5) "crc32"
[%d]=>
string(6) "crc32b"
[%d]=>
string(6) "fnv132"
[%d]=>
string(6) "fnv164"
[%d]=>
string(5) "joaat"
[%d]=>
string(10) "haval128,3"
[%d]=>
string(10) "haval160,3"
[%d]=>
string(10) "haval192,3"
[%d]=>
string(10) "haval224,3"
[%d]=>
string(10) "haval256,3"
[%d]=>
string(10) "haval128,4"
[%d]=>
string(10) "haval160,4"
[%d]=>
string(10) "haval192,4"
[%d]=>
string(10) "haval224,4"
[%d]=>
string(10) "haval256,4"
[%d]=>
string(10) "haval128,5"
[%d]=>
string(10) "haval160,5"
[%d]=>
string(10) "haval192,5"
[%d]=>
string(10) "haval224,5"
[%d]=>
string(10) "haval256,5"
}
===Done===
@@ -0,0 +1,27 @@
<?php
$algos = hash_algos();
foreach ($algos as $algo) {
var_dump($algo);
$orig = hash_init($algo);
hash_update($orig, b"I can't remember anything");
$copy = hash_copy($orig);
var_dump(hash_final($orig));
var_dump(hash_final($copy));
}
foreach ($algos as $algo) {
var_dump($algo);
$orig = hash_init($algo);
hash_update($orig, b"I can't remember anything");
$copy = hash_copy($orig);
var_dump(hash_final($orig));
hash_update($copy, b"Cant tell if this is true or dream");
var_dump(hash_final($copy));
}
echo "Done\n";
?>
@@ -0,0 +1,259 @@
string(3) "md2"
string(32) "d5ac4ffd08f6a57b9bd402b8068392ff"
string(32) "d5ac4ffd08f6a57b9bd402b8068392ff"
string(3) "md4"
string(32) "302c45586b53a984bd3a1237cb81c15f"
string(32) "302c45586b53a984bd3a1237cb81c15f"
string(3) "md5"
string(32) "e35759f6ea35db254e415b5332269435"
string(32) "e35759f6ea35db254e415b5332269435"
string(4) "sha1"
string(40) "29f62a228f726cd728efa7a0ac6a2aba318baf15"
string(40) "29f62a228f726cd728efa7a0ac6a2aba318baf15"
string(6) "sha224"
string(56) "51fd0aa76a00b4a86103895cad5c7c2651ec7da9f4fc1e50c43ede29"
string(56) "51fd0aa76a00b4a86103895cad5c7c2651ec7da9f4fc1e50c43ede29"
string(6) "sha256"
string(64) "d3a13cf52af8e9390caed78b77b6b1e06e102204e3555d111dfd149bc5d54dba"
string(64) "d3a13cf52af8e9390caed78b77b6b1e06e102204e3555d111dfd149bc5d54dba"
string(6) "sha384"
string(96) "6950d861ace4102b803ab8b3779d2f471968233010d2608974ab89804cef6f76162b4433d6e554e11e40a7cdcf510ea3"
string(96) "6950d861ace4102b803ab8b3779d2f471968233010d2608974ab89804cef6f76162b4433d6e554e11e40a7cdcf510ea3"
string(6) "sha512"
string(128) "caced3db8e9e3a5543d5b933bcbe9e7834e6667545c3f5d4087b58ec8d78b4c8a4a5500c9b88f65f7368810ba9905e51f1cff3b25a5dccf76634108fb4e7ce13"
string(128) "caced3db8e9e3a5543d5b933bcbe9e7834e6667545c3f5d4087b58ec8d78b4c8a4a5500c9b88f65f7368810ba9905e51f1cff3b25a5dccf76634108fb4e7ce13"
string(9) "ripemd128"
string(32) "5f1bc5f5aeaf747574dd34a6535cd94a"
string(32) "5f1bc5f5aeaf747574dd34a6535cd94a"
string(9) "ripemd160"
string(40) "02a2a535ee10404c6b5cf9acb178a04fbed67269"
string(40) "02a2a535ee10404c6b5cf9acb178a04fbed67269"
string(9) "ripemd256"
string(64) "547d2ed85ca0a0e3208b5ecf4fc6a7fc1e64db8ff13493e4beaf11e4d71648e2"
string(64) "547d2ed85ca0a0e3208b5ecf4fc6a7fc1e64db8ff13493e4beaf11e4d71648e2"
string(9) "ripemd320"
string(80) "785a7df56858f550966cddfd59ce14b13bf4b18e7892c4c1ad91bf23bf67639bd2c96749ba29cfa6"
string(80) "785a7df56858f550966cddfd59ce14b13bf4b18e7892c4c1ad91bf23bf67639bd2c96749ba29cfa6"
string(9) "whirlpool"
string(128) "6e60597340640e621e25f975cef2b000b0c4c09a7af7d240a52d193002b0a8426fa7da7acc5b37ed9608016d4f396db834a0ea2f2c35f900461c9ac7e5604082"
string(128) "6e60597340640e621e25f975cef2b000b0c4c09a7af7d240a52d193002b0a8426fa7da7acc5b37ed9608016d4f396db834a0ea2f2c35f900461c9ac7e5604082"
string(10) "tiger128,3"
string(32) "8d68e78bc5e62ba925a67aa48595cfc6"
string(32) "8d68e78bc5e62ba925a67aa48595cfc6"
string(10) "tiger160,3"
string(40) "8d68e78bc5e62ba925a67aa48595cfc62cd1e5e0"
string(40) "8d68e78bc5e62ba925a67aa48595cfc62cd1e5e0"
string(10) "tiger192,3"
string(48) "8d68e78bc5e62ba925a67aa48595cfc62cd1e5e08224fc35"
string(48) "8d68e78bc5e62ba925a67aa48595cfc62cd1e5e08224fc35"
string(10) "tiger128,4"
string(32) "a26ca3f58e74fb32ee44b099cb1b5122"
string(32) "a26ca3f58e74fb32ee44b099cb1b5122"
string(10) "tiger160,4"
string(40) "a26ca3f58e74fb32ee44b099cb1b512203375900"
string(40) "a26ca3f58e74fb32ee44b099cb1b512203375900"
string(10) "tiger192,4"
string(48) "a26ca3f58e74fb32ee44b099cb1b512203375900f30b741d"
string(48) "a26ca3f58e74fb32ee44b099cb1b512203375900f30b741d"
string(6) "snefru"
string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26"
string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26"
string(9) "snefru256"
string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26"
string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26"
string(4) "gost"
string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5"
string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5"
string(7) "adler32"
string(8) "6f7c0928"
string(8) "6f7c0928"
string(5) "crc32"
string(8) "e5cfc160"
string(8) "e5cfc160"
string(6) "crc32b"
string(8) "69147a4e"
string(8) "69147a4e"
string(6) "fnv132"
string(8) "98139504"
string(8) "98139504"
string(6) "fnv164"
string(16) "14522659f8138684"
string(16) "14522659f8138684"
string(5) "joaat"
string(8) "aaebf370"
string(8) "aaebf370"
string(10) "haval128,3"
string(32) "86362472c8895e68e223ef8b3711d8d9"
string(32) "86362472c8895e68e223ef8b3711d8d9"
string(10) "haval160,3"
string(40) "fabdf6905f3ba18a3c93d6a16b91e31f7222a7a4"
string(40) "fabdf6905f3ba18a3c93d6a16b91e31f7222a7a4"
string(10) "haval192,3"
string(48) "e05d0ff5723028bd5494f32c0c2494cd0b9ccf7540af7b47"
string(48) "e05d0ff5723028bd5494f32c0c2494cd0b9ccf7540af7b47"
string(10) "haval224,3"
string(56) "56b196289d8de8a22296588cf90e5b09cb6fa1b01ce8e92bca40cae2"
string(56) "56b196289d8de8a22296588cf90e5b09cb6fa1b01ce8e92bca40cae2"
string(10) "haval256,3"
string(64) "ff4d7ab0fac2ca437b945461f9b62fd16e71e9103524d5d140445a00e3d49239"
string(64) "ff4d7ab0fac2ca437b945461f9b62fd16e71e9103524d5d140445a00e3d49239"
string(10) "haval128,4"
string(32) "ee44418e0195a0c4a35d112722919a9c"
string(32) "ee44418e0195a0c4a35d112722919a9c"
string(10) "haval160,4"
string(40) "f320cce982d5201a1ccacc1c5ff835a258a97eb1"
string(40) "f320cce982d5201a1ccacc1c5ff835a258a97eb1"
string(10) "haval192,4"
string(48) "a96600107463e8e97a7fe6f260d9bf4f4587a281caafa6db"
string(48) "a96600107463e8e97a7fe6f260d9bf4f4587a281caafa6db"
string(10) "haval224,4"
string(56) "7147c9e1c1e67b942da3229f59a1ab18f121f5d7f5765ca88bc9f200"
string(56) "7147c9e1c1e67b942da3229f59a1ab18f121f5d7f5765ca88bc9f200"
string(10) "haval256,4"
string(64) "82fec42679ed5a77a841962827b88a9cddf7d677736e50bc81f1a14b99f06061"
string(64) "82fec42679ed5a77a841962827b88a9cddf7d677736e50bc81f1a14b99f06061"
string(10) "haval128,5"
string(32) "8d0b157828328ae7d34d60b4b60c1dab"
string(32) "8d0b157828328ae7d34d60b4b60c1dab"
string(10) "haval160,5"
string(40) "54dab5e10dc41503f9b8aa32ffe3bab7cf1da8a3"
string(40) "54dab5e10dc41503f9b8aa32ffe3bab7cf1da8a3"
string(10) "haval192,5"
string(48) "7d91265a1b27698279d8d95a5ee0a20014528070bf6415e7"
string(48) "7d91265a1b27698279d8d95a5ee0a20014528070bf6415e7"
string(10) "haval224,5"
string(56) "7772b2e22f2a3bce917e08cf57ebece46bb33168619a776c6f2f7234"
string(56) "7772b2e22f2a3bce917e08cf57ebece46bb33168619a776c6f2f7234"
string(10) "haval256,5"
string(64) "438a602cb1a761f7bd0a633b7bd8b3ccd0577b524d05174ca1ae1f559b9a2c2a"
string(64) "438a602cb1a761f7bd0a633b7bd8b3ccd0577b524d05174ca1ae1f559b9a2c2a"
string(3) "md2"
string(32) "d5ac4ffd08f6a57b9bd402b8068392ff"
string(32) "5c36f61062d091a8324991132c5e8dbd"
string(3) "md4"
string(32) "302c45586b53a984bd3a1237cb81c15f"
string(32) "1d4196526aada3506efb4c7425651584"
string(3) "md5"
string(32) "e35759f6ea35db254e415b5332269435"
string(32) "f255c114bd6ce94aad092b5141c00d46"
string(4) "sha1"
string(40) "29f62a228f726cd728efa7a0ac6a2aba318baf15"
string(40) "a273396f056554dcd491b5dea1e7baa3b89b802b"
string(6) "sha224"
string(56) "51fd0aa76a00b4a86103895cad5c7c2651ec7da9f4fc1e50c43ede29"
string(56) "1aee028400c56ceb5539625dc2f395abf491409336ca0f3e177a50e2"
string(6) "sha256"
string(64) "d3a13cf52af8e9390caed78b77b6b1e06e102204e3555d111dfd149bc5d54dba"
string(64) "268e7f4cf88504a53fd77136c4c4748169f46ff7150b376569ada9c374836944"
string(6) "sha384"
string(96) "6950d861ace4102b803ab8b3779d2f471968233010d2608974ab89804cef6f76162b4433d6e554e11e40a7cdcf510ea3"
string(96) "0d44981d04bb11b1ef75d5c2932bd0aa2785e7bc454daac954d77e2ca10047879b58997533fc99650b20049c6cb9a6cc"
string(6) "sha512"
string(128) "caced3db8e9e3a5543d5b933bcbe9e7834e6667545c3f5d4087b58ec8d78b4c8a4a5500c9b88f65f7368810ba9905e51f1cff3b25a5dccf76634108fb4e7ce13"
string(128) "28d7c721433782a880f840af0c3f3ea2cad4ef55de2114dda9d504cedeb110e1cf2519c49e4b5da3da4484bb6ba4fd1621ceadc6408f4410b2ebe9d83a4202c2"
string(9) "ripemd128"
string(32) "5f1bc5f5aeaf747574dd34a6535cd94a"
string(32) "f95f5e22b8875ee0c48219ae97f0674b"
string(9) "ripemd160"
string(40) "02a2a535ee10404c6b5cf9acb178a04fbed67269"
string(40) "900d615c1abe714e340f4ecd6a3d65599fd30ff4"
string(9) "ripemd256"
string(64) "547d2ed85ca0a0e3208b5ecf4fc6a7fc1e64db8ff13493e4beaf11e4d71648e2"
string(64) "b9799db40d1af5614118c329169cdcd2c718db6af03bf945ea7f7ba72b8e14f4"
string(9) "ripemd320"
string(80) "785a7df56858f550966cddfd59ce14b13bf4b18e7892c4c1ad91bf23bf67639bd2c96749ba29cfa6"
string(80) "d6d12c1fca7a9c4a59c1be4f40188e92a746a035219e0a6ca1ee53b36a8282527187f7dffaa57ecc"
string(9) "whirlpool"
string(128) "6e60597340640e621e25f975cef2b000b0c4c09a7af7d240a52d193002b0a8426fa7da7acc5b37ed9608016d4f396db834a0ea2f2c35f900461c9ac7e5604082"
string(128) "e8c6a921e7d8eac2fd21d4df6054bb27a02321b2beb5b01b6f88c40706164e64d67ec97519bf76c8af8df896745478b78d42a0159f1a0db16777771fd9d420dc"
string(10) "tiger128,3"
string(32) "8d68e78bc5e62ba925a67aa48595cfc6"
string(32) "a99d2c0348d480dc0f3c35852926e0f1"
string(10) "tiger160,3"
string(40) "8d68e78bc5e62ba925a67aa48595cfc62cd1e5e0"
string(40) "a99d2c0348d480dc0f3c35852926e0f1e1825c16"
string(10) "tiger192,3"
string(48) "8d68e78bc5e62ba925a67aa48595cfc62cd1e5e08224fc35"
string(48) "a99d2c0348d480dc0f3c35852926e0f1e1825c1651957ee3"
string(10) "tiger128,4"
string(32) "a26ca3f58e74fb32ee44b099cb1b5122"
string(32) "66e2c0322421c4e5a9208e6aeed481e5"
string(10) "tiger160,4"
string(40) "a26ca3f58e74fb32ee44b099cb1b512203375900"
string(40) "66e2c0322421c4e5a9208e6aeed481e5c4b00448"
string(10) "tiger192,4"
string(48) "a26ca3f58e74fb32ee44b099cb1b512203375900f30b741d"
string(48) "66e2c0322421c4e5a9208e6aeed481e5c4b00448e344d9d0"
string(6) "snefru"
string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26"
string(64) "614ca924864fa0e8fa309aa0944e047d5edbfd4964a35858f4d8ec66a0fb88b0"
string(9) "snefru256"
string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26"
string(64) "614ca924864fa0e8fa309aa0944e047d5edbfd4964a35858f4d8ec66a0fb88b0"
string(4) "gost"
string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5"
string(64) "a00961e371287c71c527a41c14564f13b6ed12ac7cd9d5f5dfb3542a25e28d3b"
string(7) "adler32"
string(8) "6f7c0928"
string(8) "d9141747"
string(5) "crc32"
string(8) "e5cfc160"
string(8) "59f8d3d2"
string(6) "crc32b"
string(8) "69147a4e"
string(8) "3ee63999"
string(6) "fnv132"
string(8) "98139504"
string(8) "59ad036f"
string(6) "fnv164"
string(16) "14522659f8138684"
string(16) "5e8c64fba6a5ffcf"
string(5) "joaat"
string(8) "aaebf370"
string(8) "513479b4"
string(10) "haval128,3"
string(32) "86362472c8895e68e223ef8b3711d8d9"
string(32) "ebeeeb05c18af1e53d2d127b561d5e0d"
string(10) "haval160,3"
string(40) "fabdf6905f3ba18a3c93d6a16b91e31f7222a7a4"
string(40) "f1a2c9604fb40899ad502abe0dfcec65115c8a9a"
string(10) "haval192,3"
string(48) "e05d0ff5723028bd5494f32c0c2494cd0b9ccf7540af7b47"
string(48) "d3a7315773a326678208650ed02510ed96cd488d74cd5231"
string(10) "haval224,3"
string(56) "56b196289d8de8a22296588cf90e5b09cb6fa1b01ce8e92bca40cae2"
string(56) "6d7132fabc83c9ab7913748b79ecf10e25409569d3ed144177f46731"
string(10) "haval256,3"
string(64) "ff4d7ab0fac2ca437b945461f9b62fd16e71e9103524d5d140445a00e3d49239"
string(64) "7a469868ad4b92891a3a44524c58a2b8d0f3bebb92b4cf47d19bc6aba973eb95"
string(10) "haval128,4"
string(32) "ee44418e0195a0c4a35d112722919a9c"
string(32) "6ecddb39615f43fd211839287ff38461"
string(10) "haval160,4"
string(40) "f320cce982d5201a1ccacc1c5ff835a258a97eb1"
string(40) "bcd2e7821723ac22e122b8b7cbbd2daaa9a862df"
string(10) "haval192,4"
string(48) "a96600107463e8e97a7fe6f260d9bf4f4587a281caafa6db"
string(48) "ae74619a88dcec1fbecde28e27f009a65ecc12170824d2cd"
string(10) "haval224,4"
string(56) "7147c9e1c1e67b942da3229f59a1ab18f121f5d7f5765ca88bc9f200"
string(56) "fdaba6563f1334d40de24e311f14b324577f97c3b78b9439c408cdca"
string(10) "haval256,4"
string(64) "82fec42679ed5a77a841962827b88a9cddf7d677736e50bc81f1a14b99f06061"
string(64) "289a2ba4820218bdb25a6534fbdf693f9de101362584fdd41e32244c719caa37"
string(10) "haval128,5"
string(32) "8d0b157828328ae7d34d60b4b60c1dab"
string(32) "ffa7993a4e183b245263fb1f63e27343"
string(10) "haval160,5"
string(40) "54dab5e10dc41503f9b8aa32ffe3bab7cf1da8a3"
string(40) "375ee5ab3a9bd07a1dbe5d071e07b2afb3165e3b"
string(10) "haval192,5"
string(48) "7d91265a1b27698279d8d95a5ee0a20014528070bf6415e7"
string(48) "c650585f93c6e041e835caedc621f8c42d8bc6829fb76789"
string(10) "haval224,5"
string(56) "7772b2e22f2a3bce917e08cf57ebece46bb33168619a776c6f2f7234"
string(56) "bc674d465a822817d939f19b38edde083fe5668759836c203c56e3e4"
string(10) "haval256,5"
string(64) "438a602cb1a761f7bd0a633b7bd8b3ccd0577b524d05174ca1ae1f559b9a2c2a"
string(64) "da70ad9bd09ed7c9675329ea2b5279d57761807c7aeac6340d94b5d494809457"
Done
@@ -0,0 +1,9 @@
<?php
$r = hash_init("md5");
var_dump(hash_copy());
var_dump(hash_copy($r));
var_dump(hash_copy($r, $r));
echo "Done\n";
?>
@@ -0,0 +1,6 @@
HipHop Warning: %a
NULL
resource(%d) of type (Hash Context)
HipHop Warning: %a
NULL
Done
@@ -0,0 +1,56 @@
<?php
/* Prototype : string hash_file ( string algo, string filename [, bool raw_output] )
* Description: Generate a hash value using the contents of a given file
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash_file() : basic functionality ***\n";
$file = dirname(__FILE__) . "hash_file.txt";
/* Creating a temporary file file */
if (($fp = fopen( $file, "w+")) == FALSE) {
echo "Cannot create file ($file)";
exit;
}
/* Writing into file */
$content = "This is a sample string used to test the hash_file function with various hashing algorithms";
if (is_writable($file)) {
if (fwrite($fp, $content) === FALSE) {
echo "Cannot write to file ($file)";
exit;
}
}
// close the file
fclose($fp);
echo "adler32: " . hash_file('adler32', $file) . "\n";
echo "crc32: " . hash_file('crc32', $file) . "\n";
echo "gost: " . hash_file('gost', $file). "\n";
echo "haval128,3: " . hash_file('haval128,3', $file). "\n";
echo "md2: " . hash_file('md2', $file). "\n";
echo "md4: " . hash_file('md4', $file). "\n";
echo "md5: " . hash_file('md5', $file). "\n";
echo "ripemd128: " . hash_file('ripemd128', $file). "\n";
echo "ripemd160: " . hash_file('ripemd160', $file). "\n";
echo "ripemd256: " . hash_file('ripemd256', $file). "\n";
echo "ripemd320: " . hash_file('ripemd320', $file). "\n";
echo "sha1: " . hash_file('sha1', $file). "\n";
echo "sha256: " . hash_file('sha256', $file). "\n";
echo "sha384: " . hash_file('sha384', $file). "\n";
echo "sha512: " . hash_file('sha512', $file). "\n";
echo "snefru: " . hash_file('snefru', $file). "\n";
echo "tiger192,3: " . hash_file('tiger192,3', $file). "\n";
echo "whirlpool: " . hash_file('whirlpool', $file). "\n";
echo "adler32(raw): " . bin2hex(hash_file('adler32', $file, TRUE)) . "\n";
echo "md5(raw): " . bin2hex(hash_file('md5', $file, TRUE)). "\n";
echo "sha256(raw): " . bin2hex(hash_file('sha256', $file, TRUE)). "\n";
unlink($file);
?>
===Done===
@@ -0,0 +1,23 @@
*** Testing hash_file() : basic functionality ***
adler32: ff87222e
crc32: 61664d33
gost: d9e65f0c0c2ef944e4f8a01f4a46365c4f33a2853756878182a7f03e1490a4cd
haval128,3: 8bb81269aca8b7f87829020d76a4e841
md2: 70f791c0d8fa9edd7d08e32fcba8c354
md4: a9d034b16bb290c57a645afd6f14cd3b
md5: 704bf818448f5bbb94061332d2c889aa
ripemd128: d02a5f320a11c54c7d51f933b0bd8471
ripemd160: 3ff296ca6314313af3ed0437c8fc0ebbd3242d3b
ripemd256: 0edd779587c11cf32781111b264251eb37529832fb207121cd45dd95002e48a8
ripemd320: bf162fa2ff20491b3016c5d8190f8ee47d7dcda8c38eaf6779349a243a029d275eec9adf16ec1b35
sha1: 8529b266611e3bd0d208fd9614653c2a8f23d0fe
sha256: a0f5702fa5d3670b80033d668e8732b70550392abb53841355447f8bb0f72245
sha384: a35d875ed96d94b6452acad910f97978200faa2398d8a0e6b9cffa33704c3809e3d2e5b0d63700d8f32a0716e7d2d528
sha512: 1f42adaf938fbf136e381b164bae5f984c7f9fe60c82728bd889c14f187c7d63e81a0305a1731c7e0a8f3ed9fd2ec92a3833a93502bdf269532601f0b8e2bab0
snefru: d414b2345d3e7fa1a31c044cf334bfc1fec24d89e464411998d579d24663895f
tiger192,3: 7acf4ebea075fac6fc8ea0e2b4af3cfa71b9460e4c53403a
whirlpool: 4248b149e000477269a4a5f1a84d97cfc3d0199b7aaf505913e6f010a6f83276029d11a9ad545374bc710eb59c7d958985023ab886ffa9ec9a23852844c764ec
adler32(raw): ff87222e
md5(raw): 704bf818448f5bbb94061332d2c889aa
sha256(raw): a0f5702fa5d3670b80033d668e8732b70550392abb53841355447f8bb0f72245
===Done===
@@ -0,0 +1,37 @@
<?php
/* Prototype : string hash_hmac ( string $algo , string $data , string $key [, bool $raw_output ] )
* Description: Generate a keyed hash value using the HMAC method
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash_hmac() : basic functionality ***\n";
$content = "This is a sample string used to test the hash_hmac function with various hashing algorithms";
$key = 'secret';
echo "adler32: " . hash_hmac('adler32', $content, $key) . "\n";
echo "crc32: " . hash_hmac('crc32', $content, $key) . "\n";
echo "gost: " . hash_hmac('gost', $content, $key) . "\n";
echo "haval128,3: " . hash_hmac('haval128,3', $content, $key) . "\n";
echo "md2: " . hash_hmac('md2', $content, $key) . "\n";
echo "md4: " . hash_hmac('md4', $content, $key) . "\n";
echo "md5: " . hash_hmac('md5', $content, $key) . "\n";
echo "ripemd128: " . hash_hmac('ripemd128', $content, $key) . "\n";
echo "ripemd160: " . hash_hmac('ripemd160', $content, $key) . "\n";
echo "ripemd256: " . hash_hmac('ripemd256', $content, $key) . "\n";
echo "ripemd320: " . hash_hmac('ripemd320', $content, $key) . "\n";
echo "sha1: " . hash_hmac('sha1', $content, $key) . "\n";
echo "sha256: " . hash_hmac('sha256', $content, $key) . "\n";
echo "sha384: " . hash_hmac('sha384', $content, $key) . "\n";
echo "sha512: " . hash_hmac('sha512', $content, $key) . "\n";
echo "snefru: " . hash_hmac('snefru', $content, $key) . "\n";
echo "tiger192,3: " . hash_hmac('tiger192,3', $content, $key) . "\n";
echo "whirlpool: " . hash_hmac('whirlpool', $content, $key) . "\n";
echo "adler32(raw): " . bin2hex(hash_hmac('adler32', $content, $key, TRUE)) . "\n";
echo "md5(raw): " . bin2hex(hash_hmac('md5', $content, $key, TRUE)) . "\n";
echo "sha256(raw): " . bin2hex(hash_hmac('sha256', $content, $key, TRUE)) . "\n";
?>
===Done===
@@ -0,0 +1,23 @@
*** Testing hash_hmac() : basic functionality ***
adler32: 12c803f7
crc32: 96859101
gost: a4a3c80bdf3f8665bf07376a34dc9c1b11af7c813f4928f62e39f0c0dc564dad
haval128,3: 82cd0f4bd36729b5c80c33efa8c13ac5
md2: 6d111dab563025e4cb5f4425c991fa12
md4: 10cdbfe843000c623f8b8da0d5d20b0b
md5: 2a632783e2812cf23de100d7d6a463ae
ripemd128: 26c2f694a65b1928b668cf55f65529b4
ripemd160: 4b3433ba596ec39692bb7ce760a9ee5fb818113f
ripemd256: 4e4e5ec19322895a727f272dfe68f87bc1af66cc6ce27c6c1360a5ee78a14b30
ripemd320: f10a8ff82e828b92a5ff0a02fc9032bc61352d0d824821fc42f7e09cf5b5f41ee59fd33a730d7469
sha1: 5bfdb62b97e2c987405463e9f7c193139c0e1fd0
sha256: 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838
sha384: b781415b856744834e532b9899e1aa0bec5a82cf09a838f0a833470468e2a42648a52428cfd9012385d04de5cd9bd122
sha512: 7de05636b18e2b0ca3427e03f53074af3a48a7b9df226daba4f22324c570638e7d7b26430e214799c9ce0db5ee88dad3292ca0f38bf99b8eaebed59b3a9c140a
snefru: 67af483046f9cf16fe19f9087929ccfc6ad176ade3290b4d33f43e0ddb07e711
tiger192,3: 00a0f884f15a9e5549ed0e40ca0190522d369027e16d5b59
whirlpool: 4a0f1582b21b7aff59bfba7f9c29131c69741b2ce80acdc7d314040f3b768cf5a17e30b74cceb86fbc6b34b1692e0addd5bfd7cfc043d40c0621f1b97e26fa49
adler32(raw): 12c803f7
md5(raw): 2a632783e2812cf23de100d7d6a463ae
sha256(raw): 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838
===Done===
@@ -0,0 +1,65 @@
<?php
/* Prototype : string hash_hmac_file ( string algo, string filename, string key [, bool raw_output] )
* Description: Generate a keyed hash value using the HMAC method and the contents of a given file
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash_hmac_file() : basic functionality ***\n";
$file = dirname(__FILE__) . "hash_hmac_file.txt";
/* Creating a temporary file file */
if (($fp = fopen( $file, "w+")) == FALSE) {
echo "Cannot create file ($file)";
exit;
}
/* Writing into file */
$content = "This is a sample string used to test the hash_hmac_file function with various hashing algorithms";
if (is_writable($file)) {
if (fwrite($fp, $content) === FALSE) {
echo "Cannot write to file ($file)";
exit;
}
}
// close the files
fclose($fp);
$key = 'secret';
echo "adler32: " . hash_hmac_file('adler32', $file, $key) . "\n";
echo "crc32: " . hash_hmac_file('crc32', $file, $key) . "\n";
echo "gost: " . hash_hmac_file('gost', $file, $key) . "\n";
echo "haval128,3: " . hash_hmac_file('haval128,3', $file, $key) . "\n";
echo "md2: " . hash_hmac_file('md2', $file, $key) . "\n";
echo "md4: " . hash_hmac_file('md4', $file, $key) . "\n";
echo "md5: " . hash_hmac_file('md5', $file, $key) . "\n";
echo "ripemd128: " . hash_hmac_file('ripemd128', $file, $key) . "\n";
echo "ripemd160: " . hash_hmac_file('ripemd160', $file, $key) . "\n";
echo "ripemd256: " . hash_hmac_file('ripemd256', $file, $key) . "\n";
echo "ripemd320: " . hash_hmac_file('ripemd320', $file, $key) . "\n";
echo "sha1: " . hash_hmac_file('sha1', $file, $key) . "\n";
echo "sha256: " . hash_hmac_file('sha256', $file, $key) . "\n";
echo "sha384: " . hash_hmac_file('sha384', $file, $key) . "\n";
echo "sha512: " . hash_hmac_file('sha512', $file, $key) . "\n";
echo "snefru: " . hash_hmac_file('snefru', $file, $key) . "\n";
echo "tiger192,3: " . hash_hmac_file('tiger192,3', $file, $key) . "\n";
echo "whirlpool: " . hash_hmac_file('whirlpool', $file, $key) . "\n";
echo "adler32(raw): " . bin2hex(hash_hmac_file('adler32', $file, $key, TRUE)) . "\n";
echo "md5(raw): " . bin2hex(hash_hmac_file('md5', $file, $key, TRUE)). "\n";
echo "sha256(raw): " . bin2hex(hash_hmac_file('sha256', $file, $key, TRUE)). "\n";
echo "Error cases:\n";
hash_hmac_file();
hash_hmac_file('foo', $file);
hash_hmac_file('foo', $file, $key, TRUE, 10);
unlink($file);
?>
===Done===
@@ -0,0 +1,27 @@
*** Testing hash_hmac_file() : basic functionality ***
adler32: 0f8c02f9
crc32: f2a60b9c
gost: 94c39a40d5db852a8dc3d24e37eebf2d53e3d711457c59cd02b614f792a9d918
haval128,3: e8fcff647f1a675acb429130fb94a17e
md2: a685475e600314bb549ab4f33c3b27cb
md4: cbc6bff781f48f57378d3effa27553e4
md5: 8bddf39dd1c566c27acc7fa85ec36acf
ripemd128: 03269b76bf61d508c50f038cbe9ba691
ripemd160: 94652211292268d97eb63344a3a05d3009f9d2d3
ripemd256: b6ab414cc1630e1e474fefa41976d252f38ca7cf401552774e71736165e512e7
ripemd320: 71271a649265740eed4b9931417f979fd81eba6288f4e08ff2997bc3dd6858da054d53a9f1fffe8c
sha1: 7f338d17b72371091abd28f451bc8d1f3a9eb3b6
sha256: 9135286ca4c84dec711e4b831f6cd39e672e5ff93d011321274eb76733cc1e40
sha384: 364fdc45a4c742763366ab5d3d1c17c24057e6c3b641607a36d969f00c88da25b19c8b88c8632411e3a0a02397f88aca
sha512: d460aabdf0353655059ed0d408efa91f19c4cda46acc2a4e0adf4764b06951c899fbb2ed41519db78b58ff7be17b1b2910aebe674a56861b232143571b35c83f
snefru: 7b79787e1c1d926b6cc98327f05c5d04ba6227ab51c1398661861196016ef34c
tiger192,3: ca89badf843ba68e3fae5832635aa848a72a4bc11676edd4
whirlpool: 37a0fbb90547690d5e5e11c046f6654ffdb7bab15e16d9d79c7d85765cc4bdcbfd9df8db7a3ce9558f3f244fead00ca29cf05297f75596555195a0683f15d69f
adler32(raw): 0f8c02f9
md5(raw): 8bddf39dd1c566c27acc7fa85ec36acf
sha256(raw): 9135286ca4c84dec711e4b831f6cd39e672e5ff93d011321274eb76733cc1e40
Error cases:
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
===Done===
+27
Ver Arquivo
@@ -0,0 +1,27 @@
<?php
$tests = array(
array("hello world", "3e4a5a57"),
array("", 0),
array("", "000000"),
array("a", "ca2e9442"),
array("aa", "7081738e"),
);
$i = 0;
$pass = true;
foreach ($tests as $test) {
++$i;
$result = hash("joaat", $test[0]);
if ($result != $test[1]) {
echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
$pass = false;
}
}
if($pass) {
echo "PASS";
}
?>
@@ -0,0 +1 @@
PASS
+31
Ver Arquivo
@@ -0,0 +1,31 @@
<?php
$supported_hash_al = array(
"MHASH_MD5" => "2d9bdb91f94e96d9c4e2ae532acc936a",
"MHASH_SHA1" => "2f9341e55a9083edf5497bf83ba3db812a7de0a3",
"MHASH_HAVAL256" => "b255feff01ad641b27358dc7909bc695a1fca53bddfdfaf19020b275928793af",
"MHASH_HAVAL192" => "4ce837de481e1e30092ab2c610057094c988dfd7db1e01cd",
"MHASH_HAVAL224" => "5362d1856752bf2c139bb2d6fdd772b9c515c8ce5ec82695264b85e1",
"MHASH_HAVAL160" => "c6b36f87750b18576981bc17b4f22271947bf9cb",
"MHASH_RIPEMD160" => "6c47435aa1d359c4b7c6af46349f0c3e1258583d",
"MHASH_GOST" => "101b0a2552cebdf5137cadf15147f21e55b6432935bb9c2c03c7e28d188b2d9e",
"MHASH_TIGER" => "953ac3799a01b9fdeb91aeab97207e67395cbb54300be00d",
"MHASH_CRC32" => "83041db8",
"MHASH_CRC32B" => "df5ab7a4"
);
$data = "This is the test of the mhash extension...";
foreach ($supported_hash_al as $hash=>$wanted) {
$result = mhash(constant($hash), $data);
if (bin2hex($result)==$wanted) {
echo "$hash\nok\n";
} else {
echo "$hash: ";
var_dump($wanted);
echo "$hash: ";
var_dump(bin2hex($result));
}
echo "\n";
}
?>
@@ -0,0 +1,32 @@
MHASH_MD5
ok
MHASH_SHA1
ok
MHASH_HAVAL256
ok
MHASH_HAVAL192
ok
MHASH_HAVAL224
ok
MHASH_HAVAL160
ok
MHASH_RIPEMD160
ok
MHASH_GOST
ok
MHASH_TIGER
ok
MHASH_CRC32
ok
MHASH_CRC32B
ok
+38
Ver Arquivo
@@ -0,0 +1,38 @@
<?php
$supported_hash_al = array(
"MD5" => 16,
"MD4" => 16,
"SHA1" => 20,
"SHA256" => 32,
"HAVAL256" => 32,
"HAVAL192" => 24,
"HAVAL224" => 28,
"HAVAL160" => 20,
"HAVAL128" => 16,
"RIPEMD160" => 20,
"GOST" => 32,
"TIGER" => 24,
"TIGER160" => 20,
"TIGER128" => 16,
"CRC32" => 4,
"CRC32B" => 4,
"ADLER32" => 4,
"NA_XYZ" => 0 /* verify that the algorythm works */
);
$hc = mhash_count() + 1;
$known_hash_al = array();
for ($i=0; $i < $hc; $i++) {
$known_hash_al[mhash_get_hash_name($i)] = $i;
}
foreach ($supported_hash_al as $name => $len) {
if (array_key_exists($name, $known_hash_al)) {
$len = mhash_get_block_size($known_hash_al[$name]);
echo "$name = $len\n";
} else {
echo "$name ? $len\n";
}
}
?>
@@ -0,0 +1,18 @@
MD5 . 16
MD4 . 16
SHA1 . 20
SHA256 . 32
HAVAL256 . 32
HAVAL192 . 24
HAVAL224 . 28
HAVAL160 . 20
HAVAL128 . 16
RIPEMD160 . 20
GOST . 32
TIGER . 24
TIGER160 . 20
TIGER128 . 16
CRC32 . 4
CRC32B . 4
ADLER32 . 4
NA_XYZ . 0
+31
Ver Arquivo
@@ -0,0 +1,31 @@
<?php
$supported_hash_al = array(
"MHASH_MD5" => "8690154eaf9432cde9347aa15094b9c046eb06e6a0940c5479aa7a6367ae68b5e0e0745e5709fede2d9fe9739d9aad413759faa73acced821077b4ddb2788064e371eb53b3a9d55ed2839aab2655c82cfedbe83a208461c799d9d77ae481061c81539b01",
"MHASH_SHA1" => "dd315c70061d07455d53c2fb0b08df0c61aa665c1ab1a701fa10955423248ba832a5ade406b39b78630aba3d1688e622494a0eae279d4ece9ad4bdf76e878fcb084a33c9153c2b48131d30a75b00a7c05b91f1ffeabf59bb1271c4d8a11990b84baf6d49",
"MHASH_HAVAL256" => "0ede47009f87d5e9a24ecf5077d60c483657a5d98404ab2bb780f5872c90caf61c0d67645a848e55fee107296f4169c95b4e61f0aeeefab2648554c1171fb0a2fc32aa5aeed3d5c155d334367d4959622cdadefe43ae17bd1a75f9d4fef77bf192be5b78",
"MHASH_HAVAL224" => "5c4aff3d825ad608f608c8eae779ee3868610bc60a98f3d770b311a6677c797fc2dadcab71dde0c0191e068397ab297f0de5cbbc6cbcd0c78ca8470c42401f6b77e81dc2ba8d51930ff982760335324fb850ac2d30b73514004c096d60472d320e0ec349",
"MHASH_HAVAL192" => "22e0c27126023c852ef94107bb2f1ee132b064178b9dcbfb1c32e658760b8f70bdc5b1c52599031628c2433bee2b0870ab7a38aeb21215134ec1088975b9a96487642971ef9eb3d987baf9765fd9e6d64d494e1719aa84afe7e0a0784c74979ebab1c787",
"MHASH_HAVAL160" => "d6e5f0ef07f3facced646eedb6364758ecde6dc6fb061e00a496f5ceb723f78ea135884d9682226ded69c11d8431240ef97cad583c4f29593bbf3dd3cab0b8792eb3d86022ca6002ebd0d9b4429909d4af85bed2b5a96b3e47b9b8cac919c1177ec40d7e",
"MHASH_RIPEMD160" => "e4d5db469af29f78e2b90dc735c9cf020a1d5b19a6674458677794d4dca144d426c562aff98d8e866a8a924299ebf6b0ea9a1637f987a1fb5de9b647edc35b1447605e1babc3084be7a003931117eb33432d4142e225df044b033f3ff64bb4a18682a4f9",
"MHASH_GOST" => "c044f669bd7e8643953d77c682fd179242d9df157dadf873be4d9601e4647c018234689359e7220ab0492a6240d184c478634073dea87f79be7f86fd4e2564f7d709b68a46440a121250e00fc7d57d45a9c07ee23a704ff4148c0dad7077ec527b194d87",
"MHASH_TIGER" => "470aca9d7bc9ea67e46402332f26f6b15532fe6037231cce297912d32f5142f6276b2358e7f1ccba8b116ec0c0c2a46845f7a5042f0ee41906c0db9ba9b80f82181720314d2a70981bba79da4bc9c4564d95f8d709d5604fd48d369797a218a862196f48",
"MHASH_CRC32" => "481c40148c26185f9a59ef18e86f51c5d2d0315b46711d22ae08c1ccdd669fe956c817380815e3a545f6ee453c9da48d1d994dbc3ac8ba85a572108412f06b2a16b1489cda75b118e82f7d9bdfdb68336957bbf19e4a3f76750d6985a53dd557229dfcf3",
"MHASH_CRC32B" => "65ab6cb5fb7d3ea67f5da92a9bd746b6628a13368fcbcd43af49092e9c6a960fd030a5ce3c1f0ddb512ec698be96e77969748db66278b0fd837d24d8c898f50bd70993b48cc8accf4b44c54431e91385ddf04c7560a1a7368fc9e6f763457c90b07f04f1"
);
foreach ($supported_hash_al as $hash=>$wanted) {
$passwd = str_repeat($hash, 10);
$salt = str_repeat($hash, 2);
$result = mhash_keygen_s2k(constant($hash), $passwd, $salt, 100);
if (!strcmp(bin2hex($result), $wanted)) {
echo "$hash\nok\n";
} else {
echo "$hash: ";
var_dump($wanted);
echo "$hash: ";
var_dump(bin2hex($result));
}
echo "\n";
}
?>
@@ -0,0 +1,32 @@
MHASH_MD5
ok
MHASH_SHA1
ok
MHASH_HAVAL256
ok
MHASH_HAVAL224
ok
MHASH_HAVAL192
ok
MHASH_HAVAL160
ok
MHASH_RIPEMD160
ok
MHASH_GOST
ok
MHASH_TIGER
ok
MHASH_CRC32
ok
MHASH_CRC32B
ok
+8
Ver Arquivo
@@ -0,0 +1,8 @@
<?php
$algo = MHASH_MD5;
var_dump($algo);
var_dump(bin2hex(mhash($algo, "test")));
var_dump($algo);
?>
@@ -0,0 +1,3 @@
int(1)
string(32) "098f6bcd4621d373cade4e832627b4f6"
int(1)
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
echo hash('sha224', '') . "\n";
echo hash('sha224', 'a') . "\n";
echo hash('sha224', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha224', 'abc') . "\n";
echo hash('sha224', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('sha224', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,6 @@
d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f
abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5
ae5c0d27fe120752911c994718296a3bccc77000aac07b8810714932
23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7
75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525
20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67
+7
Ver Arquivo
@@ -0,0 +1,7 @@
<?php
echo hash('tiger192,3', ''),"\n";
echo hash('tiger192,3', 'abc'),"\n";
echo hash('tiger192,3', str_repeat('a', 63)),"\n";
echo hash('tiger192,3', str_repeat('abc', 61)),"\n";
echo hash('tiger192,3', str_repeat('abc', 64)),"\n";
?>
@@ -0,0 +1,5 @@
3293ac630c13f0245f92bbb1766e16167a4e58492dde73f3
2aab1484e8c158f2bfb8c5ff41b57a525129131c957b5f93
9366604ea109e48ed763caabb2d5633b4946eb295ef5781a
b19abf166d158625808f035edf8be4e6b0bcb31d070ec353
badd965340a9e83e4a16f48a5038c01b856a9158ef59fec1
+8
Ver Arquivo
@@ -0,0 +1,8 @@
<?php
echo hash('gost', ''), "\n";
echo hash('gost', 'The quick brown fox jumps over the lazy dog'), "\n";
echo hash('gost', 'The quick brown fox jumps over the lazy cog'), "\n";
echo hash('gost', str_repeat('a', 31)), "\n";
echo hash('gost', str_repeat('a', 32)), "\n";
echo hash('gost', str_repeat('a', 33)), "\n";
?>
@@ -0,0 +1,6 @@
ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d
77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294
a3ebc4daaab78b0be131dab5737a7f67e602670d543521319150d2e14eeec445
03840d6348763f11e28e7b1ecc4da0cdf7f898fa555b928ef684c6c5b8f46d9f
fd1b746d9397e78edd311baef391450434271e02816caa37680d6d7381c79d4e
715e59cdc8ebde9fdf0fe2a2e811b3bf7f48209a01505e467d2cd2aa2bbb5ecf
+22
Ver Arquivo
@@ -0,0 +1,22 @@
<?php
/* Prototype : string hash ( string $algo , string $data [, bool $raw_output ] )
* Description: Generate a hash value (message digest)
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash() : error conditions ***\n";
echo "\n-- Testing hash() function with less than expected no. of arguments --\n";
var_dump(hash());
var_dump(hash('adler32'));
echo "\n-- Testing hash() function with more than expected no. of arguments --\n";
$extra_arg= 10;
var_dump(hash('adler32', '', false, $extra_arg));
echo "\n-- Testing hash() function with invalid hash algorithm --\n";
var_dump(hash('foo', ''));
?>
===Done===
@@ -0,0 +1,16 @@
*** Testing hash() : error conditions ***
-- Testing hash() function with less than expected no. of arguments --
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
-- Testing hash() function with more than expected no. of arguments --
HipHop Warning: %a
NULL
-- Testing hash() function with invalid hash algorithm --
HipHop Warning: %a
bool(false)
===Done===
@@ -0,0 +1,27 @@
<?php
/* Prototype : string hash_file(string algo, string filename[, bool raw_output = false])
* Description: Generate a hash of a given file
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash_file() : basic functionality ***\n";
// Set up file
$filename = 'hash_file_example.txt';
file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' );
var_dump( hash_file( 'md5', $filename ) );
var_dump( hash_file( 'sha1', $filename ) );
var_dump( hash_file( 'sha256', $filename ) );
var_dump( hash_file( 'sha512', $filename ) );
var_dump( base64_encode( hash_file( 'md5', $filename, true ) ) );
?>
===DONE===<?php
$filename = 'hash_file_example.txt';
unlink( $filename );
?>
@@ -0,0 +1,7 @@
*** Testing hash_file() : basic functionality ***
string(32) "5c6ffbdd40d9556b73a21e63c3e0e904"
string(40) "c0854fb9fb03c41cce3802cb0d220529e6eef94e"
string(64) "68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483"
string(128) "0a8c150176c2ba391d7f1670ef4955cd99d3c3ec8cf06198cec30d436f2ac0c9b64229b5a54bdbd5563160503ce992a74be528761da9d0c48b7c74627302eb25"
string(24) "XG/73UDZVWtzoh5jw+DpBA=="
===DONE===
@@ -0,0 +1,35 @@
<?php
/* Prototype : string hash_file(string algo, string filename[, bool raw_output = false])
* Description: Generate a hash of a given file
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash_file() : error conditions ***\n";
// Set up file
$filename = 'hash_file_example.txt';
file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' );
// hash_file() error tests
echo "\n-- Testing hash_file() function with an unknown algorithm --\n";
var_dump( hash_file( 'foobar', $filename ) );
echo "\n-- Testing hash_file() function with a non-existant file --\n";
var_dump( hash_file( 'md5', 'nonexistant.txt' ) );
echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n";
var_dump( hash_file( 'md5' ) );
echo "\n-- Testing hash_file() function with more than expected no. of arguments --\n";
$extra_arg = 10;
var_dump( hash_file( 'md5', $filename, false, $extra_arg ) );
?>
===DONE===<?php
$filename = 'hash_file_example.txt';
unlink( $filename );
?>
@@ -0,0 +1,18 @@
*** Testing hash_file() : error conditions ***
-- Testing hash_file() function with an unknown algorithm --
HipHop Warning: %a
bool(false)
-- Testing hash_file() function with a non-existant file --
HipHop Warning: %a
bool(false)
-- Testing hash_file() function with less than expected no. of arguments --
HipHop Warning: %a
NULL
-- Testing hash_file() function with more than expected no. of arguments --
HipHop Warning: %a
NULL
===DONE===
@@ -0,0 +1,25 @@
<?php
/*
* proto string hash_hmac ( string algo, string data, string key [, bool raw_output] )
* Function is implemented in ext/hash/hash.c
*/
echo "*** Testing hash_hmac() : error conditions ***\n";
$data = "This is a sample string used to test the hash_hmac function with various hashing algorithms";
$key = 'secret';
echo "\n-- Testing hash_hmac() function with less than expected no. of arguments --\n";
var_dump(hash_hmac());
var_dump(hash_hmac('crc32'));
var_dump(hash_hmac('crc32', $data));
echo "\n-- Testing hash_hmac() function with more than expected no. of arguments --\n";
$extra_arg = 10;
var_dump(hash_hmac('crc32', $data, $key, TRUE, $extra_arg));
echo "\n-- Testing hash_hmac() function with invalid hash algorithm --\n";
var_dump(hash_hmac('foo', $data, $key));
?>
===Done===
@@ -0,0 +1,18 @@
*** Testing hash_hmac() : error conditions ***
-- Testing hash_hmac() function with less than expected no. of arguments --
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
-- Testing hash_hmac() function with more than expected no. of arguments --
HipHop Warning: %a
NULL
-- Testing hash_hmac() function with invalid hash algorithm --
HipHop Warning: %a
bool(false)
===Done===
@@ -0,0 +1,27 @@
<?php
/* Prototype : string hash_hmac_file ( string algo, string filename, string key [, bool raw_output] )
* Description: Generate a keyed hash value using the HMAC method and the contents of a given file
* Source code: ext/hash/hash.c
* Alias to functions:
*/
echo "*** Testing hash() : error conditions ***\n";
$file = dirname(__FILE__) . "hash_file.txt";
$key = 'secret';
echo "\n-- Testing hash_hmac_file() function with less than expected no. of arguments --\n";
var_dump(hash_hmac_file());
var_dump(hash_hmac_file('crc32'));
var_dump(hash_hmac_file('crc32', $file));
echo "\n-- Testing hash_hmac_file() function with more than expected no. of arguments --\n";
$extra_arg = 10;
hash_hmac_file('crc32', $file, $key, TRUE, $extra_arg);
echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n";
hash_hmac_file('foo', $file, $key, TRUE);
?>
===Done===
@@ -0,0 +1,16 @@
*** Testing hash() : error conditions ***
-- Testing hash_hmac_file() function with less than expected no. of arguments --
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
-- Testing hash_hmac_file() function with more than expected no. of arguments --
HipHop Warning: %a
-- Testing hash_hmac_file() function with invalid hash algorithm --
HipHop Warning: %a
===Done===
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
echo "Empty String\n";
for($pass=3; $pass<=5; $pass++)
for($bits=128; $bits <= 256; $bits += 32) {
$algo = sprintf('haval%d,%d',$bits,$pass);
echo $algo . ': ' . hash($algo,'') . "\n";
}
echo "\"abc\"\n";
for($pass=3; $pass<=5; $pass++)
for($bits=128; $bits <= 256; $bits += 32) {
$algo = sprintf('haval%d,%d',$bits,$pass);
echo $algo . ': ' . hash($algo,'abc') . "\n";
}
echo "\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789\"\n";
for($pass=3; $pass<=5; $pass++)
for($bits=128; $bits <= 256; $bits += 32) {
$algo = sprintf('haval%d,%d',$bits,$pass);
echo $algo . ': ' . hash($algo,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789') . "\n";
}
@@ -0,0 +1,48 @@
Empty String
haval128,3: c68f39913f901f3ddf44c707357a7d70
haval160,3: d353c3ae22a25401d257643836d7231a9a95f953
haval192,3: e9c48d7903eaf2a91c5b350151efcb175c0fc82de2289a4e
haval224,3: c5aae9d47bffcaaf84a8c6e7ccacd60a0dd1932be7b1a192b9214b6d
haval256,3: 4f6938531f0bc8991f62da7bbd6f7de3fad44562b8c6f4ebf146d5b4e46f7c17
haval128,4: ee6bbf4d6a46a679b3a856c88538bb98
haval160,4: 1d33aae1be4146dbaaca0b6e70d7a11f10801525
haval192,4: 4a8372945afa55c7dead800311272523ca19d42ea47b72da
haval224,4: 3e56243275b3b81561750550e36fcd676ad2f5dd9e15f2e89e6ed78e
haval256,4: c92b2e23091e80e375dadce26982482d197b1a2521be82da819f8ca2c579b99b
haval128,5: 184b8482a0c050dca54b59c7f05bf5dd
haval160,5: 255158cfc1eed1a7be7c55ddd64d9790415b933b
haval192,5: 4839d0626f95935e17ee2fc4509387bbe2cc46cb382ffe85
haval224,5: 4a0513c032754f5582a758d35917ac9adf3854219b39e3ac77d1837e
haval256,5: be417bb4dd5cfb76c7126f4f8eeb1553a449039307b1a3cd451dbfdc0fbbe330
"abc"
haval128,3: 9e40ed883fb63e985d299b40cda2b8f2
haval160,3: b21e876c4d391e2a897661149d83576b5530a089
haval192,3: a7b14c9ef3092319b0e75e3b20b957d180bf20745629e8de
haval224,3: 5bc955220ba2346a948d2848eca37bdd5eca6ecca7b594bd32923fab
haval256,3: 8699f1e3384d05b2a84b032693e2b6f46df85a13a50d93808d6874bb8fb9e86c
haval128,4: 6f2132867c9648419adcd5013e532fa2
haval160,4: 77aca22f5b12cc09010afc9c0797308638b1cb9b
haval192,4: 7e29881ed05c915903dd5e24a8e81cde5d910142ae66207c
haval224,4: 124c43d2ba4884599d013e8c872bfea4c88b0b6bf6303974cbe04e68
haval256,4: 8f409f1bb6b30c5016fdce55f652642261575bedca0b9533f32f5455459142b5
haval128,5: d054232fe874d9c6c6dc8e6a853519ea
haval160,5: ae646b04845e3351f00c5161d138940e1fa0c11c
haval192,5: d12091104555b00119a8d07808a3380bf9e60018915b9025
haval224,5: 8081027a500147c512e5f1055986674d746d92af4841abeb89da64ad
haval256,5: 976cd6254c337969e5913b158392a2921af16fca51f5601d486e0a9de01156e7
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789"
haval128,3: ddf4304cc5ffa3db8aab60d4f8fc2a00
haval160,3: e709559359b15917623050e41d27a306c6c3a9db
haval192,3: 51e25280ad356c06f4b913b3cdb3abaaac5879dda0a4fea4
haval224,3: 28aa2c164e10bb3076574cc8aa8584fd6d04f6d82c37ea5c21e451b3
haval256,3: 5537364e3d75174b846d21adf9b113f9d8f97e4750df64d428c01e782f9ade4d
haval128,4: c7d981e8270e39888ba96cafe8745636
haval160,4: 3444e38cc2a132b818b554ced8f7d9592df28f57
haval192,4: 0ca58f140ed92828a27913ce5636611abcada220fccf3af7
haval224,4: a9d0571d0857773e71363e4e9dfcca4696dba3e5019e7225e65e0cb1
haval256,4: 1858d106bdc2fc787445364a163cfc6027597a45a58a2490d14203c8b9bdd268
haval128,5: d41e927ea041d2f0c255352b1a9f6195
haval160,5: f3245e222e6581d0c3077bd7af322af4b4fedab7
haval192,5: fc45dc17a7b19adfed2a6485921f7af7951d70703b9357c1
haval224,5: 29687958a6f0d54d495105df00dbda0153ee0f5708408db68a5bbea5
haval256,5: f93421623f852ac877584d1e4bba5d9345a95f81bfd277fe36dfeed1815f83d5
+11
Ver Arquivo
@@ -0,0 +1,11 @@
<?php
/* Test Vectors from RFC 2104 */
$ctx = hash_init('md5',HASH_HMAC,str_repeat(chr(0x0b), 16));
hash_update($ctx, 'Hi There');
echo hash_final($ctx) . "\n";
$ctx = hash_init('md5',HASH_HMAC,'Jefe');
hash_update($ctx, 'what do ya want for nothing?');
echo hash_final($ctx) . "\n";
echo hash_hmac('md5', str_repeat(chr(0xDD), 50), str_repeat(chr(0xAA), 16)) . "\n";
@@ -0,0 +1,3 @@
9294727a3638bb1c13f48ef8158bfc9d
750c783e6ab0b503eaa86e310a5db738
56be34521d144c88dbb8c733f0e8b3f6
+8
Ver Arquivo
@@ -0,0 +1,8 @@
<?php
echo hash('md2', '') . "\n";
echo hash('md2', 'a') . "\n";
echo hash('md2', 'abc') . "\n";
echo hash('md2', 'message digest') . "\n";
echo hash('md2', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('md2', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('md2', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
@@ -0,0 +1,7 @@
8350e5a3e24c153df2275c9f80692773
32ec01ec4a6dac72c0ab96fb34c0b5d1
da853b0d3f88d99b30283a69e6ded6bb
ab4f496bfb2a530b219ff33031fe06b0
4e8ddff3650292ab5a4108c3aa47940b
da33def2a42df13975352846c30338cd
d5976f79d83d3a0dc9806c3c66f3efd8
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
/* RFC 1320 vectors */
echo hash('md4', '') . "\n";
echo hash('md4', 'a') . "\n";
echo hash('md4', 'abc') . "\n";
echo hash('md4', 'message digest') . "\n";
echo hash('md4', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('md4', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('md4', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
@@ -0,0 +1,7 @@
31d6cfe0d16ae931b73c59d7e0c089c0
bde52cb31de33e46245e05fbdbd6fb24
a448017aaf21d8525fc10ae87aa6729d
d9130a8164549fe818874806e1c7014b
d79e1c308aa5bbcdeea8ed63df412da9
043f8582f241db351ce627e153e7f0e4
e33b4ddc9c38f2199c3e7b164fcc0536
+5
Ver Arquivo
@@ -0,0 +1,5 @@
<?php
echo hash('md5', '') . "\n";
echo hash('md5', 'a') . "\n";
echo hash('md5', '012345678901234567890123456789012345678901234567890123456789') . "\n";
echo hash('md5', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,4 @@
d41d8cd98f00b204e9800998ecf8427e
0cc175b9c0f1b6a831c399e269772661
1ced811af47ead374872fcca9d73dd71
7707d6ae4e027c70eea2a935c2296f21
+10
Ver Arquivo
@@ -0,0 +1,10 @@
<?php
echo hash('ripemd128', '') . "\n";
echo hash('ripemd128', 'a') . "\n";
echo hash('ripemd128', 'abc') . "\n";
echo hash('ripemd128', 'message digest') . "\n";
echo hash('ripemd128', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('ripemd128', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('ripemd128', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('ripemd128', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
echo hash('ripemd128', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,9 @@
cdf26213a150dc3ecb610f18f6b38b46
86be7afa339d0fc7cfc785e72f578d33
c14a12199c66e4ba84636b0f69144c77
9e327b3d6e523062afc1132d7df9d1b8
fd2aa607f71dc8f510714922b371834e
a1aa0689d0fafa2ddc22e88b49133a06
d1e959eb179c911faea4624c60c5c702
3f45ef194732c2dbb2c4a2c769795fa3
4a7f5723f954eba1216c9d8f6320431f
+10
Ver Arquivo
@@ -0,0 +1,10 @@
<?php
echo hash('ripemd160', '') . "\n";
echo hash('ripemd160', 'a') . "\n";
echo hash('ripemd160', 'abc') . "\n";
echo hash('ripemd160', 'message digest') . "\n";
echo hash('ripemd160', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('ripemd160', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('ripemd160', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('ripemd160', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
echo hash('ripemd160', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,9 @@
9c1185a5c5e9fc54612808977ee8f548b2258d31
0bdc9d2d256b3ee9daae347be6f4dc835a467ffe
8eb208f7e05d987a9b044a8e98c6b087f15a0bfc
5d0689ef49d2fae572b881b123a85ffa21595f36
f71c27109c692c1b56bbdceb5b9d2865b3708dbc
12a053384a9c0c88e405a06c27dcf49ada62eb2b
b0e20b6e3116640286ed3a87a5713079b21f5189
9b752e45573d4b39f4dbd3323cab82bf63326bfb
52783243c1697bdbe16d37f97f68f08325dc1528
+10
Ver Arquivo
@@ -0,0 +1,10 @@
<?php
echo hash('ripemd256', '') . "\n";
echo hash('ripemd256', 'a') . "\n";
echo hash('ripemd256', 'abc') . "\n";
echo hash('ripemd256', 'message digest') . "\n";
echo hash('ripemd256', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('ripemd256', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('ripemd256', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('ripemd256', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
echo hash('ripemd256', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,9 @@
02ba4c4e5f8ecd1877fc52d64d30e37a2d9774fb1e5d026380ae0168e3c5522d
f9333e45d857f5d90a91bab70a1eba0cfb1be4b0783c9acfcd883a9134692925
afbd6e228b9d8cbbcef5ca2d03e6dba10ac0bc7dcbe4680e1e42d2e975459b65
87e971759a1ce47a514d5c914c392c9018c7c46bc14465554afcdf54a5070c0e
649d3034751ea216776bf9a18acc81bc7896118a5197968782dd1fd97d8d5133
3843045583aac6c8c8d9128573e7a9809afb2a0f34ccc36ea9e72f16f6368e3f
5740a408ac16b720b84424ae931cbb1fe363d1d0bf4017f1a89f7ea6de77a0b8
06fdcc7a409548aaf91368c06a6275b553e3f099bf0ea4edfd6778df89a890dd
ac953744e10e31514c150d4d8d7b677342e33399788296e43ae4850ce4f97978
+10
Ver Arquivo
@@ -0,0 +1,10 @@
<?php
echo hash('ripemd320', '') . "\n";
echo hash('ripemd320', 'a') . "\n";
echo hash('ripemd320', 'abc') . "\n";
echo hash('ripemd320', 'message digest') . "\n";
echo hash('ripemd320', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('ripemd320', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('ripemd320', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('ripemd320', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
echo hash('ripemd320', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,9 @@
22d65d5661536cdc75c1fdf5c6de7b41b9f27325ebc61e8557177d705a0ec880151c3a32a00899b8
ce78850638f92658a5a585097579926dda667a5716562cfcf6fbe77f63542f99b04705d6970dff5d
de4c01b3054f8930a79d09ae738e92301e5a17085beffdc1b8d116713e74f82fa942d64cdbc4682d
3a8e28502ed45d422f68844f9dd316e7b98533fa3f2a91d29f84d425c88d6b4eff727df66a7c0197
cabdb1810b92470a2093aa6bce05952c28348cf43ff60841975166bb40ed234004b8824463e6b009
d034a7950cf722021ba4b84df769a5de2060e259df4c9bb4a4268c0e935bbc7470a969c9d072a1ac
ed544940c86d67f250d232c30b7b3e5770e0c60c8cb9a4cafe3b11388af9920e1b99230b843c86a4
557888af5f6d8ed62ab66945c6d2a0a47ecd5341e915eb8fea1d0524955f825dc717e4a008ab2d42
bdee37f4371e20646b8b0d862dda16292ae36f40965e8c8509e63d1dbddecc503e2b63eb9245bb66
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
echo hash('sha1', '') . "\n";
echo hash('sha1', 'a') . "\n";
echo hash('sha1', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha1', 'abc') . "\n";
echo hash('sha1', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('sha1', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,6 @@
da39a3ee5e6b4b0d3255bfef95601890afd80709
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
f52e3c2732de7bea28f216d877d78dae1aa1ac6a
a9993e364706816aba3e25717850c26c9cd0d89d
84983e441c3bd26ebaae4aa1f95129e5e54670f1
34aa973cd4c4daa4f61eeb2bdbad27316534016f
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
echo hash('sha256', '') . "\n";
echo hash('sha256', 'a') . "\n";
echo hash('sha256', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha256', 'abc') . "\n";
echo hash('sha256', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('sha256', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,6 @@
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb
5e43c8704ac81f33d701c1ace046ba9f257062b4d17e78f3254cbf243177e4f2
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1
cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
echo hash('sha384', '') . "\n";
echo hash('sha384', 'a') . "\n";
echo hash('sha384', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha384', 'abc') . "\n";
echo hash('sha384', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu') . "\n";
echo hash('sha384', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,6 @@
38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b
54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31
ce6bebce38aad0fd35805b50f77f3e1814d46df8e930356ec905a5d7b94bfa615fce4c3b6caf50eb4a7f1a1164887470
cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7
09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039
9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
echo hash('sha512', '') . "\n";
echo hash('sha512', 'a') . "\n";
echo hash('sha512', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha512', 'abc') . "\n";
echo hash('sha512', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu') . "\n";
echo hash('sha512', str_repeat('a', 1000000)) . "\n";
@@ -0,0 +1,6 @@
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75
e3e33e00eec4753ea01c134b21c52badc44d364648ba2321ff18aa213902759b04f7f0dbfff426acec097c09476adcd0666d2d86e8cc2fcd4f7c549acbfbfd94
ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f
8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909
e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b
+7
Ver Arquivo
@@ -0,0 +1,7 @@
<?php
echo hash('snefru', ''), "\n";
echo hash('snefru', 'The quick brown fox jumps over the lazy dog'), "\n";
echo hash('snefru', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), "\n";
echo hash('snefru', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), "\n";
echo hash('snefru', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), "\n";
?>
@@ -0,0 +1,5 @@
8617f366566a011837f4fb4ba5bedea2b892f3ed8b894023d16ae344b2be5881
674caa75f9d8fd2089856b95e93a4fb42fa6c8702f8980e11d97a142d76cb358
94682bc46e5fbb8417e2f3e10ed360484048d946bb8cbb0ea4cad2700dbeaab0
c54c602ac46383716ee7200a76c9c90a7b435bbe31d13f04e0b00a7ea5c347fa
7a8539c59e192e8d70b1ab82aa86a1b54560d42020bda4e00ddd6d048fe3bcaa
+5
Ver Arquivo
@@ -0,0 +1,5 @@
<?php
echo hash('whirlpool', ''), "\n";
echo hash('whirlpool', $s='---qwertzuiopasdfghjklyxcvbnm------qwertzuiopasdfghjklyxcvbnm---'), "\n";
echo hash('whirlpool', str_repeat($s.'0', 1000)), "\n";
?>
@@ -0,0 +1,3 @@
19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3
916ce6431d2f384be68d96bcaba800c21b82e9cc2f07076554c9557f85476b5d8f2b263951121fa955e34b31a4cdc857bdf076b123c2252543dcef34f84a7ef3
b51984710d11893ac08e10529519f9801d82ea534629d14bc8c810307934496017ccdf23bfcb62c7e1259664e84c9388ff646b0b46688b0a6c32e5571234dd95
-1
Ver Arquivo
@@ -103,7 +103,6 @@ no_import = (
# not imported yet, but will be
'/ext/exif',
'/ext/gd',
'/ext/hash',
'/ext/iconv',
'/ext/imap',
'/ext/intl',