NameSilo

Md5 execution time?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Tree

Established Member
Impact
9
Anyone know how long (on average) generating the md5 hash of a string takes?

I ask because I'm generating the md5 hash of the md5 hash of a base64_encoded string. Would that take a long time?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
erm... i dont know the number offhand but u cud always run a test by having php take the time first, then run through the md5 hash making process and then take the time again, find the difference, and echo it.
 
0
Close
I don't need the exact number, I just need to know if it is feasable to do this, or if it would put too much stress on the server and/or take too long. I know that base64_encoding the same string three times in a row takes quite a bit of time.
 
0
Close
Barely any time at all... you can see a test here (see the end result at the very bottom of this post):

Without encoding/double hashing: http://y1v.net/timer2.php
With encoding/double hashing: http://y1v.net/timer.php

This is running on a standard linux server configuration.

Source of timer2.php:
Code:
<?php 

// Brendan Bates
// www.multibb.net

$timeparts = explode(' ',microtime());
$thetime = $timeparts[1].substr($timeparts[0],1);

$string = "This is a string to be base 64 encoded.";

$timeparts = explode(' ',microtime());
$starttime = $timeparts[1].substr($timeparts[0],1);
$timeparts = explode(' ',microtime());
$endtime = $timeparts[1].substr($timeparts[0],1);
echo "<b>Exec Time:</b> ";
echo bcsub($endtime,$starttime,6);

echo "<br>";
echo "Final String: ";
echo $string;

?>

Source of timer.php:
Code:
<?php 

// Brendan Bates
// www.multibb.net

$timeparts = explode(' ',microtime());
$thetime = $timeparts[1].substr($timeparts[0],1);

$string = "This is a string to be base 64 encoded.";
$string = base64_encode($string);
$string = md5(md5($string));

$timeparts = explode(' ',microtime());
$starttime = $timeparts[1].substr($timeparts[0],1);
$timeparts = explode(' ',microtime());
$endtime = $timeparts[1].substr($timeparts[0],1);
echo "<b>Exec Time:</b> ";
echo bcsub($endtime,$starttime,6);

echo "<br>";
echo "Final String: ";
echo $string;

?>

End Result: (on an average of 10 loads) about 0.00003 seconds different. Hope that helps you out :).

I had this from an experiment I did a while back. So, from what I've concluded, it shouldn't put barely any extra stress on your server at all.
 
1
Close
Last edited:
0
Close
Is it really necessary to encode it that many times?
md5("salt".$_SERVER['PHP_SELF']); would be just as secure and take less (but barely noticable) time to execute.
 
0
Close
I don't know if you take Algebra 2 or Chemistry, but 2.264E-05 = 0.00002264 seconds (just to let you know :P). And honestly, the md5 algorithm is extremely efficient. I don't know about base64 that much, but it seems pretty efficient also. Shouldn't make much difference at all.
 
0
Close
MasterB said:
I don't know if you take Algebra 2 or Chemistry

Took it, never used it since.

Alright, thanks guys.

Jim_ said:
Is it really necessary to encode it that many times?

Well, not really. :p
 
0
Close
Hmm...one thing to say: Very, very, very fast. Much, much, much faster than you can say "encrypt!"
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back