PDA

View Full Version : Realistically, Would this matter?



Tree
March 6th, 2006, 19:19
I've got a script that utilizes double md5 hashing and a base64 encryption to secure something. The base64 algorithm is highly inefficient, but would it really slow down a page that loads? I've set up a script just for this purpose.

With hashing
http://www.vestieo.com/Noname1.php?

Without
[Same URL as above, just add something that would go into the $_GET variable. IF you don't know what $_GET is, I'm not sure I want you answering ;)]

That number shown is the average of 90,000 trials.

Question:

Is 0.000009750166666687563044035869 seconds really noticable?

Johnson
March 6th, 2006, 19:27
Tree, that much time is...EXTREMELY noticable. Think how much I could do in that time!

Tree
March 6th, 2006, 19:31
Well, the pages need to not be slowed down at all by this code.

So, it might...

stuffradio
March 6th, 2006, 20:59
wow it takes too much time for me... I don't think md5 hashing should slow it down that much... show me your code next time you go on and I'll see if I notice anything that'd speed it up :P

Brandon
March 6th, 2006, 21:12
Remove the Base64..why? Md5 is pretty sufficient nowadays, if you got someone who has the time to use software to crack an md5, they are going to get past Base64 anyway :P

Tree
March 7th, 2006, 18:41
wow it takes too much time for me... I don't think md5 hashing should slow it down that much... show me your code next time you go on and I'll see if I notice anything that'd speed it up :P

It takes a lot of time because it executes the code 90,000 times and then takes the average.

Code that I used:

<?php
if (!$_GET)
{
for ($i=1;$i<90000;$i++){
$timeparts = explode(' ',microtime());
$thetime = $timeparts[1].substr($timeparts[0],1);

$string = md5(md5(base64_encode($_SERVER['PHP_SELF'])));

$timeparts = explode(' ',microtime());
$starttime = $timeparts[1].substr($timeparts[0],1);
$timeparts = explode(' ',microtime());
$endtime = $timeparts[1].substr($timeparts[0],1);
$difference[$i] = bcsub($endtime,$starttime,52);
}
$F_endtime = number_format(((array_sum($difference))/90000),52);

echo "<b>Final Endtime Time:</b> ";
echo $F_endtime;
echo "<br>";
echo "Final String: ";
echo $string;
}
if ($_GET)
{
for ($i=1;$i<90000;$i++){
$timeparts = explode(' ',microtime());
$thetime = $timeparts[1].substr($timeparts[0],1);

$string = $_SERVER['PHP_SELF'];

$timeparts = explode(' ',microtime());
$starttime = $timeparts[1].substr($timeparts[0],1);
$timeparts = explode(' ',microtime());
$endtime = $timeparts[1].substr($timeparts[0],1);
$difference[$i] = bcsub($endtime,$starttime,52);
}
$F_endtime = number_format(((array_sum($difference))/90000),52);

echo "<b>Final Endtime Time:</b> ";
echo $F_endtime;
echo "<br>";
echo "Final String: ";
echo $string;
}

?>

Many thanks to Brendan Bates (MasterB) from NamePros for the majority of this script.

DarkBlood
March 7th, 2006, 18:51
Final Endtime Time: 0.0000169351111111224073013659108255524188280105590820
Final String: 28f8d541fe62f936675565247d3c9ec7

is what I get at Madison Area Technical College

Tree
March 7th, 2006, 21:19
The final string is always going to be the same, because it is the double hash of the base64 encoded $_SERVER['PHP_SELF']. $_SERVER['PHP_SELF'] is always going to be Noname1.php in this case.

I got 0.0000161028666666660802420096842979546636343002319336