[General] Why do people insist on using md5?

Status
Not open for further replies.
Joined
Apr 29, 2005
Messages
6,400
Reaction score
130
I just don't get it. I've been working a lot with scripts not written by me recently and I noticed that almost all of them used md5 when something needed hashing, which confuses me. Why would anyone still use the old vulnerable md5 hash when there is far superior alternative available that requires no extra effort at all? Sha1 to be precise.

I personally always use sha1 when hashing something, I sometimes even use a double hash when it concerns important data, like passwords stored in cookies for example. Is it just me being paranoid? Or is it that people are just too lazy to update their code? (Which I would still find quite weird because sha1 wasn't created much later than md5)

Anyone who is able to give a rational explanation for this?
 
i always do sha1(salt + md5(salt2 + password,or,so))
since md5 gets cracked all the time
 
Yup, varies for the importance of things.
If something is very important and CAN NOT be revealed you have to make up a really hard combo.
PHP:
<?php
function encrypt($str)
{
	$str = sha1(md5(crypt(sha1(sha1(md5(md5(sha1(md5(sha1($str))))))), '$1hkjsahj4asdfF')));
	return $str;
}

echo encrypt("admin"). "<br />";
?>
Like that :P:?
 
PHP:
<?php
   
   function string_encryption($string)
   {
      if ($string == "")
      {
         $string = null;
      }
      else
      {
         $string = md5($string . "Iweiof903rWEIO03");
         $string = sha1($string . "UIEFERUIERIFOJE");
      }

      return $string;
   }

?>
 
PHP:
<?php
$msg = "This is some message that I just wrote";
$enc_msg = md5($msg);
print "hash2: $enc_msg <br /><br />";
?>

Output : 81ea092649ca32b5ba375e81d8f4972c

PHP:
<?php
// Notice that 'message' is missing an 's'
$msg = "This is some mesage that I just wrote";
$enc_msg = md5($msg);
print "hash2: $enc_msg <br /><br />";
?>

OutPut : e86cf511bd5490d46d5cd61738c82c0c

Try both the above examples and check the difference in the MD5 hash. By altering one character, there is a big difference in the MD5 hash, although the result is 32 characters. Thus MD5 is a great tool to check even the minor differences in Data.

I personally always use sha1 when hashing something, I sometimes even use a double hash when it concerns important data, like passwords stored in cookies for example. Is it just me being paranoid? Or is it that people are just too lazy to update their code? (Which I would still find quite weird because sha1 wasn't created much later than md5)
I know that its mandatory to have encryption to Cookies, but if you are using PHP platform, Its always better to make use of PHP Sessions to store sensitive information, rather than using Cookies. They might be chances where Hackers can fool your website, by altering the cookie data.
 
eh, i asked my forum for you.
Here what they said:


you're a douche, what's wrong with md5? it's a one-way cipher and you can't decrypt it. it is in no way "vulnerable". there are however alot of databases out there, which hash words and keep them available for people to lookup. the same would happen with sha1 if it were as popular.

md5 combined with a salt string (a random string of characters) would make something that you simply can't decrypt, and will never be found on a database site such as gdataonline or other variants.
 
Of course you CAN decrypt it, there are laaaaarge md5 databases containing thousands of word. And as a friend of mine said, why to call x functions to make a safe hash when you can use just one(sha2, whirlpool).

here this page, http://www.md5decrypter.com/ can for example decrypt most of the lame passwords used nowadays(eg. "pass123").

//edit oups, they actually told you there are databases, ive only read the first sentence :)
 
Last edited:
Last edited:
you cant get totaly secure but using some salt and sha1 is a pretty good start..

i would like to see your login-checking-function when you crypt like this: O.o
PHP:
sha1(md5($pass + microtime()))
do you save the microtime in the database?

The Problem is that if the "bad bad cracker" knows how you crypt your passwords he can break it. The question is how long it takes. There is NO DIFFERENCE of bruteforcing md5(sha1(md5(sha1('lol')))) and md5('lol') .. you just need to alter your programm. whatever.. salts are pretty good against rainbow tables and stuff like that because no rainbowtable i know knows words with more than 10 characters... but times your enemy ;-)
 
you cant get totaly secure but using some salt and sha1 is a pretty good start..

i would like to see your login-checking-function when you crypt like this: O.o
PHP:
sha1(md5($pass + microtime()))
do you save the microtime in the database?

The Problem is that if the "bad bad cracker" knows how you crypt your passwords he can break it. The question is how long it takes. There is NO DIFFERENCE of bruteforcing md5(sha1(md5(sha1('lol')))) and md5('lol') .. you just need to alter your programm. whatever.. salts are pretty good against rainbow tables and stuff like that because no rainbowtable i know knows words with more than 10 characters... but times your enemy ;-)
haha yea, I realised it later :)
Code:
 3.1.2009 
23:34:52 
foxx 
Who 
[COLOR=#800000][B]uh[/B][/COLOR]  3.1.2009 
23:34:53 
foxx 
Who 
[COLOR=#800000][B]wait[/B][/COLOR]  3.1.2009 
23:34:55 
foxx 
Who 
[COLOR=#800000][B]no  sense[/B][/COLOR]  3.1.2009 
23:35:00 
foxx 
Who 
[COLOR=#800000][B]because[/B][/COLOR]  3.1.2009 
23:35:09 
foxx 
Who 
[COLOR=#800000][B]using  microtime in password[/B][/COLOR]  3.1.2009 
23:35:14 
foxx 
Who 
[COLOR=#800000][B]you  wouldn't ever be able[/B][/COLOR]  3.1.2009 
23:35:17 
foxx 
Who 
[COLOR=#800000][B]to  [/B][/COLOR]  3.1.2009 
23:35:23 
foxx 
Who 
[COLOR=#800000][B]get it  again.. for a login etc[/B][/COLOR]

anyway we've come to conclusion that
PHP:
sha2($pass + "yoursecretword")
would be the best
 
Status
Not open for further replies.
Back