问题描述
所以,有这个网站(http://md5decrypter.co.uk)的,给予MD5哈希值,将尝试返回原始字符串。
So, there's this website (http://md5decrypter.co.uk) which, given an md5 hash, will attempt to return the original string.
有没有一个API或者已经有人做一个PHP类与它合作?我无法找到一个...
Is there an API or has someone made a PHP class to work with it? I can't find one...
你问,之前,让我向你保证,我没有恶意。
Before, you ask, let me assure you that I have no malicious intent.
感谢您提前。
推荐答案
但即便如此,从md5decryptor的家伙是好的,他不会让自己的资产通过HTTP访问你只是因为你的要求。正如其他人可以使用它需要一个验证码公开发布的webinterface - 这说的一切
Even so the guy from md5decryptor is nice, he won't make his asset accessible to you via HTTP only because you're asking. As anybody else you can use the publicly available webinterface which requires a captcha - which says everything.
或简称:没有没有没有PHP API那里
Or in short: No there ain't no PHP API out there.
但是,你为什么不跑你自己?这是相当简单:
However, why don't you run your own? It's rather trivial:
$decryptors = array('Google', 'Gromweb');
foreach ($hashes as $hash) {
echo "$hash";
foreach($decryptors as $decrytor)
{
if (NULL !== ($plain = MD5Decryptor::plain($hash, $decrytor))) {
echo " - found: $plain ($decrytor)";
break;
}
}
echo "\n";
}
输出:
fcf1eed8596699624167416a1e7e122e - found: octopus (Google)
bed128365216c019988915ed3add75fb - found: passw0rd (Google)
d0763edaa9d9bd2a9516280e9044d885 - found: monkey (Google)
dfd8c10c1b9b58c8bf102225ae3be9eb - found: 12081977 (Google)
ede6b50e7b5826fe48fc1f0fe772c48f - found: 1q2w3e4r5t6y (Google)
那些你不能够直接查表,您可以在手动该网站粘贴。请记住,如果有更多的人认为像你这样,越来越多的网站会下降(其中大部分已经)。
Those you're not able to directly look-up, you can paste at that site manually. Keep in mind if more folks think like you, more and more sites will go down (most of them are already).
abstract class MD5Decryptor
{
abstract public function probe($hash);
public static function plain($hash, $class = NULL)
{
if ($class === NULL) {
$class = get_called_class();
} else {
$class = sprintf('MD5Decryptor%s', $class);
}
$decryptor = new $class();
if (count($hash) > 1) {
foreach ($hash as &$one) {
$one = $decryptor->probe($one);
}
} else {
$hash = $decryptor->probe($hash);
}
return $hash;
}
public function dictionaryAttack($hash, array $wordlist)
{
$hash = strtolower($hash);
foreach ($wordlist as $word) {
if (md5($word) === $hash)
return $word;
}
}
}
abstract class MD5DecryptorWeb extends MD5Decryptor
{
protected $url;
public function getWordlist($hash)
{
$list = FALSE;
$url = sprintf($this->url, $hash);
if ($response = file_get_contents($url)) {
$list[$response] = 1;
$list += array_flip(preg_split('/\s+/', $response));
$list += array_flip(preg_split('/(?:\s|\.)+/', $response));
$list = array_keys($list);
}
return $list;
}
public function probe($hash)
{
$hash = strtolower($hash);
return $this->dictionaryAttack($hash, $this->getWordlist($hash));
}
}
class MD5DecryptorGoogle extends MD5DecryptorWeb
{
protected $url = 'http://www.google.com/search?q=%s';
}
class MD5DecryptorGromweb extends MD5DecryptorWeb
{
protected $url = 'http://md5.gromweb.com/query/%s';
}
这篇关于md5decrypter API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!