Jump to content

Add MD5 hash to POST code


webguync

Recommended Posts

well since it is going into the database you might wanna just incase.

 

As already stated, there is no need to do so, and it can actually be problematic to escape data that will be hashed. Here's why:

 

include('db_conn.php');
$string = "This \string\ is Bob's.";
echo md5($string) . " Hash of: $string";
echo '<br>' . md5(mysqli_real_escape_string($dbc, $string)) . " Hash of: " . mysqli_real_escape_string($dbc, $string);

 

The above returns this result. Make note that the hashed values do not match because the escaped string is different from the original.

Hash:  58d026576a486ce984336c666a941e0a  $string: This \string\ is Bob's.
Hash:  ad29428d5e650e5fa47d03f8ff21222a     Escaped $string: This \\string\\ is Bob\'s.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.