corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
<?php // ۞// text { encoding:utf-8 ; bom:no ; linebreaks:unix ; tabs:4sp ; }
/*
Simple tests for the homebrew mshash function.
v0.2, updated to use newer hash_hmac() php functions for comparison.
Still matches the homebrew function!
have fun!
;o)
(c) 2006->tomorrow! ~ cor + corz.org ;o)
Please view the license for this free software, here:
https://corz.org/free-scripts-licence.nfo
*/
include 'homebrew-mhash.php';
if (!empty($_POST['data'])) { $data = $_POST['data']; }
else { $data = 'this is the data'; }
if (!empty($_POST['key'])) { $key = $_POST['key']; }
else { $key = 'some key'; }
echo '<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="content-type" content="application/xml; charset=utf-8" /><head><title>simple php and javascript sha1 hashing login demo.. password accepted!</title></head><body><br /><br /><br /><div style="text-align:center"><span style="font-size: 2em; color:#D134C2;font-weight:bold;">a few tests for the homebrew mhash..</span></div>
<form id="" class="" method="post" action="">
<div class="form">
input new test values..<br />
<input name="data" id="data" type="text" value="',$data,'" />
<input name="key" id="key" type="text" value="',$key,'" />
<input name="compute" id="compute" type="submit" value="compute!" />
</div>
</form>';
$test['. built-in functions..'] = '';
$test['. base64_ hash_hmac(sha1..)'] = base64_encode(hash_hmac('sha1', $data, $key, true));
$test['. bin2hex_hmac(sha1..)'] = bin2hex(hash_hmac('sha1', $data, $key, true));
$test['. base64_hmac(md5..)'] = base64_encode(hash_hmac('md5', $data, $key, true));
$test['. bin2hex_hmac(md5..)'] = bin2hex(hash_hmac('md5', $data, $key, true));
$test['.. homebrew functions..'] = '';
$test['.. base64_my_mhash-sha1'] = base64_encode(my_mhash('sha1', $data, $key));
$test['.. bin2hex_my_mhash-sha1'] = bin2hex(my_mhash('sha1', $data, $key));
$test['.. base64_my_mhash-md5'] = base64_encode(my_mhash('md5', $data, $key));
$test['.. bin2hex_my_mhash-md5'] = bin2hex(my_mhash('md5', $data, $key));
echo "<pre>\n\ndata: $data\n";
echo "key: $key\n\n";
echo '$test: '.print_r($test, true).'<br /></pre>'."\n";
echo '
</body>
</html>';
?>