Ad

Recover Encrypted Value With Md5 Using $_GET

- 1 answer

i want to pass value from php page to another using url, values are encrypted using md5,so I get in url http://localhost/1.php?id=8f14e45fceea167a5a36dedd4bea2543 that's what i want but in my second page and when i use $_GET["id"] I can't see the value,just md5 value,so there are any function to decrypt this md5 value? Thank you.

1Page :

<script type="text/javascript">
function fn(a)
{  
   var table = document.getElementsByTagName("table")[0];
   //var secondRow = table.rows[a];
   //alert(secondRow.id ); 
    var res=table.rows[a].cells[0].innerHTML;
    alert(res);  
}
</script>
<table class="table " id="tableId">
    <?php 

$i=0;
while ( $i<= 10) {  
echo "
    <tr onclick=\"location.href='2.php?id=".md5($i)."'\">
    <input type='hidden' name='cid' value='11' />
    <td>$i</td>                          
  </a></tr>";
$i++;
}
 ?>
</table>
</body>

2Page :

<?php 

print_r($_GET["id"]) ; //result :8f14e45fceea167a5a36dedd4bea2543 

?>
Ad

Answer

MD5 hashes are one way, they cant be decrypted. If they could be decrypted, the world would save billions of dollars in storage space as we could fit an infinite string into 32 characters / bytes. Without going into too much detail, it's like adding 1+4+5+1+2+3+.... and getting a single number of 16. Unless we know the original values, we cant actually determine how many numbers were added up to make 16 or what the original numbers where.

Hope this helps in your understanding of hashing.

Ad
source: stackoverflow.com
Ad