PDA

Просмотр полной версии : Hash PHP Generator


lomerok
07.06.2008, 13:36
вот скрипт который записывает сгенериный Хэш в файл ...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=cp1251" />
</head>
<body>
<form method="GET">
Введите MD5 хэш :
<input type="text" name="hash">
<input type="submit" value="OK">
</form>
<?
global $hash2;
//$hash=isset($_GET['hash']) ? $_GET['hash'] : '';
//----------------Get Hash-------------------------------------------------------------------
function gethash($hash)
{
global $hash2;
$f="test.txt";
$file=file_get_contents($f);
preg_match("/(^|\n){$hash}:(\S+)/s",$file,$m);
if(isset($m[0]))
{$hash2=$m[0];print "ok";}
}
//---------------Random Hash---------------------------------------------------------------
function random($max)
{
$chars="12";
$size=StrLen($chars)-1;
$password=null;

while($max--)
{
$password.=$chars[rand(0,$size)];
}
$hash1="\n".md5($password).":$password";
gethash(md5($password));
print "<br>hash1=$hash1";
print "<br>hash2=$hash2";
if($hash1==$hash2) {print "<br>Существует !!!";}
else
{
print "<br>Записано !!!";
$file="test.txt";
$fo=fopen($file,"a+");
fwrite($fo,$hash1);
fclose($fo);
}
}
$i=0;

while($i<5)
{
random(2);
print "<br><hr>";
$i++;
}
?>
</body>
</html>

неработает $hash2 в функции random при вызове gethash(md5($password)). почему ??

BlackSun
07.06.2008, 13:54
for ($i=0; $i<50; $i++)
{
.....

Chaak
07.06.2008, 15:16
Очень полезный скрипт от товарисча I-I()/Ib
<?php
$hash=array(array('md3, md4 hmac, md5, md5 hmac, ripmed 128, NTHash, LM, MacroHash','/^[a-zA-Z0-9]{32}$/'),
array('md4 base64, md5 base64,','/^[a-zA-Z0-9\/\+]{22}\=\=[a-zA-Z0-9\/]{3}\=$/'),
array('md5 Unix,','/^\$\d\$[\D\d]*\$[a-zA-Z0-9\.\/]{22}$/'),
array('md5 APR,','/^\$apr1\$[\D\d]*\$[a-zA-Z0-9\.\/]{22}$/'),
array('mysql,','/^[a-zA-Z0-9]{16}$/'),
array('sha-1 base64,','/^[a-zA-Z0-9\/\+\=]{28}$/'),
array('mysql5, sha-1, sha-1 hmac, ripmed 160,','/^[a-zA-Z0-9]{40}$/'),
array('sha-256, ГОСТ Р34.11-94, ripmed 256,','/^[a-zA-Z0-9]{64}$/'),
array('ripmed 320,','/^[a-zA-Z0-9]{80}$/'),
array('sha-384,','/^[a-zA-Z0-9]{98}$/'),
array('crc16, crc16-ccitt,','/^[a-zA-Z0-9]{4}$/'),
array('crc32, crc32b, GHash-32, Adler32','/^[a-zA-Z0-9]{8}$/'),
array('sha-512,','/^[a-zA-Z0-9]{128}$/'));
if(!empty($_POST['hash1'])){
$hashstr='';
for($i=0;$i<count($hash);$i++){
if(preg_match($hash[$i]['1'],$_POST['hash1']))$hashstr.=$hash[$i]['0'];
}
if(!empty($hashstr))echo('Это похоже на '.$hashstr.' <hr>');
else echo('Это что то хитрое o_O<hr>');
}
echo('<form method="post">
<input type="text" name="hash1" value=""><input type="submit" value="прочекать">
</form>');
?>

Советую часть кода прикрутить...

lomerok
07.06.2008, 15:46
разобрался , роботает

schwarze
14.05.2009, 21:41
У кого-нить есть исходники hash функции получения MySQL OLD_PASSWORD ?