Pages

Tuesday 7 May 2013

Decode MD5 Code in PHP, Magento


?php
function decode_md5($hash)
{
  //simple check for md5 hash
  if(!preg_match('/^[a-f0-9]{32}$/i',$hash))return '';

  //make request to service
  $pass=file_get_contents('http://md5.darkbyte.ru/api.php?q='.$hash);

  //not found
  if(!$pass)return '';

  //found, but not valid
  if(md5($pass)!=strtolower($hash))return '';

  //found :)
  return $pass;
}

function encode_md5($pass)
{
  //add padding, if str length eq 32
  if(strlen($pass)==32)$pass.='=';
 
  //make request to service
  return file_get_contents('http://md5.darkbyte.ru/api.php?q='.urlencode($pass));
}
?>

<?php
echo $pass=decode_md5('b70d2c477ff9129a937efc41f2424ae0'); ?>

2 comments:

  1. The article is good to read and worth sharing for more knowledge- https://www.facebook.com/hiremagentodeveloper

    ReplyDelete
  2. I just like the post shared and it would be worth when we see people giving their valuable feedback which motivates the author.Thanks for sharing. for more knowledge Triple glazed wood windows

    ReplyDelete