1--TEST-- 2Crypto\Hash::hexdigest basic usage. 3--FILE-- 4<?php 5$one_block_msg = "abc"; 6$multi_block_msg = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; 7 8function crypto_test_hash_hexdigest_run($alg, $title, $msg) { 9 echo "$title\n"; 10 $hash = new Crypto\Hash($alg); 11 $hash->update($msg); 12 echo $hash->hexdigest() . "\n"; 13} 14 15function crypto_test_hash_hexdigest($alg) { 16 global $one_block_msg, $multi_block_msg; 17 18 crypto_test_hash_hexdigest_run( 19 $alg, "$alg (one-block message)", $one_block_msg); 20 crypto_test_hash_hexdigest_run( 21 $alg, "$alg (multi-block message)", $multi_block_msg); 22} 23 24crypto_test_hash_hexdigest('md5'); 25crypto_test_hash_hexdigest('sha1'); 26crypto_test_hash_hexdigest('sha256'); 27crypto_test_hash_hexdigest('sha512'); 28crypto_test_hash_hexdigest('sha384'); 29echo "SUCCESS\n" 30?> 31--EXPECT-- 32md5 (one-block message) 33900150983cd24fb0d6963f7d28e17f72 34md5 (multi-block message) 358215ef0796a20bcaaae116d3876c664a 36sha1 (one-block message) 37a9993e364706816aba3e25717850c26c9cd0d89d 38sha1 (multi-block message) 3984983e441c3bd26ebaae4aa1f95129e5e54670f1 40sha256 (one-block message) 41ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad 42sha256 (multi-block message) 43248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 44sha512 (one-block message) 45ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f 46sha512 (multi-block message) 47204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445 48sha384 (one-block message) 49cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 50sha384 (multi-block message) 513391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b 52SUCCESS 53