Author Topic: What is the point of MD5?  (Read 32227 times)

0 Members and 1 Guest are viewing this topic.

Offline neil.johnson

  • Guru
  • Fanatic
  • *
  • Posts: 3,416
  • Gender: Male
    • View Profile
Re: What is the point of MD5?
« Reply #30 on: May 29, 2009, 06:48:55 AM »
Quote
I know all this, but the main thing was just suprise, so i had heard how strong and unreversable md5 was and then saw how easy it was to crack so i have to ask what is the point, it is actually easier to crack than some simple 5 line home brew encryption function, but as i now know if you salt it then very difficult.

Then just salt it. It was created in 1991 (processing power back then was nowhere near the level of today) and in 1996 up to 2004 serious flaws were documented. SHA1 is recomended as oppose to MD5. Wherever you got your initial information from about MD5 people were obviously misinformed and you have taken their view as gospel. Again whatever algorithm you use depends on what you are protecting. MD5 is fine for most websites. People wont spend time trying to crack it. I wouldn't lock my garden shed with a bank vault safe door however a simple padlock will do the job.
« Last Edit: May 29, 2009, 06:49:55 AM by neil.johnson »
Quote
To start, press any key. Where's the 'Any' key?

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: What is the point of MD5?
« Reply #31 on: May 29, 2009, 06:53:11 AM »
NO am i not missing the point of hashing, for a single pass of md5 this simple brute forcer takes a matter of minutes to crack a 6 character password with [a-z][A-Z][0-9],

Actually, you completely missed the point. Hashing truly is one-way. You cannot know if the match you found is the original plain text value or one of the colliding values. All you know is that what you found shares the same hash as the original value has. Hashing is not encryption, and there is no such thing as cracking a hash nor brute-forcing a hash.

I'll send you $50 over PayPal if you tell me what the what the plaintext value I used for this hash is:
9f65f29197e64cef1f862f359866c3abdc473da40a0efd1f6 bca32fb13cfb5da
It's not enough finding a string that matches the hash. You must prove that what you got is the same as what I originally had. Anyone else who wants to try can claim the $50 as well.

Offline discomatt

  • Addict
  • Posts: 1,936
  • Gender: Male
    • View Profile
Re: What is the point of MD5?
« Reply #32 on: May 29, 2009, 06:58:53 AM »
I'll send you $50 over PayPal if you tell me what the what the plaintext value I used for this hash is:
9f65f29197e64cef1f862f359866c3abdc473da40a0efd1f6 bca32fb13cfb5da
It's not enough finding a string that matches the hash. You must prove that what you got is the same as what I originally had. Anyone else who wants to try can claim the $50 as well.

May I have 5.2^114 guesses?

Offline neil.johnson

  • Guru
  • Fanatic
  • *
  • Posts: 3,416
  • Gender: Male
    • View Profile
Re: What is the point of MD5?
« Reply #33 on: May 29, 2009, 06:59:19 AM »
Quote
I'll send you $50 over PayPal if you tell me what the what the plaintext value I used for this hash is
9f65f29197e64cef1f862f359866c3abdc473da40a0efd1f6 bca32fb13cfb5da
Susan Boyle to win Britain's Got Talent

It's got to be!
Quote
To start, press any key. Where's the 'Any' key?

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: What is the point of MD5?
« Reply #34 on: May 29, 2009, 06:59:56 AM »
I'll send you $50 over PayPal if you tell me what the what the plaintext value I used for this hash is:
9f65f29197e64cef1f862f359866c3abdc473da40a0efd1f6 bca32fb13cfb5da
It's not enough finding a string that matches the hash. You must prove that what you got is the same as what I originally had. Anyone else who wants to try can claim the $50 as well.

May I have 5.2^114 guesses?

Sure, as long as you can prove that it isn't a collision ;)

Offline Ken2k7

  • Freak!
  • Posts: 5,174
    • View Profile
Re: What is the point of MD5?
« Reply #35 on: May 29, 2009, 10:13:40 AM »
A 65-character hash. Wow!
Quote from: Slaytanist
A programmer who shys away from elegant tricks will never be more than competent at best. Ego and a desire to attempt the impossible are traits of most great coders.

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: What is the point of MD5?
« Reply #36 on: May 29, 2009, 10:33:47 AM »
It's SHA-256. Now I've already helped immensely :P

I'll let the offer stand though.

Offline neil.johnson

  • Guru
  • Fanatic
  • *
  • Posts: 3,416
  • Gender: Male
    • View Profile
Re: What is the point of MD5?
« Reply #37 on: May 29, 2009, 10:42:18 AM »
Quote
It's SHA-256. Now I've already helped immensely
Hang on i'm still plugging in my 2000 playstations
Quote
To start, press any key. Where's the 'Any' key?

Offline neil.johnson

  • Guru
  • Fanatic
  • *
  • Posts: 3,416
  • Gender: Male
    • View Profile
Re: What is the point of MD5?
« Reply #38 on: May 29, 2009, 11:01:45 AM »
Given that it is a one way algorithm there is absolutely no way of obtaining the plain text value of the hash. 5 Playstations exploded upto now.
Quote
To start, press any key. Where's the 'Any' key?

Offline DarkSuperHero

  • Enthusiast
  • Posts: 340
  • Gender: Male
    • View Profile
    • PHP Video Tutorials
Re: What is the point of MD5?
« Reply #39 on: May 29, 2009, 11:08:06 AM »
What type of information should we web developers be concerned about concealing that we would worry so much about hashing with salt ect?(im refering to other than the obvious cc/personal information which we my guess should be encrypted before its stored?)

 For example, if we have a database, would some one trying to get in have a higher chance of succeeding at accessing the database and changing the hash value to a known one, or would they have higher success rate obtaining the hash or a collision of the hash?

Should I as a developer put more effort into making sure XSS and SQL injections and other security measures are up in place before loosing my hair over hashing/ encryption issues?

I think i know the answers to these questions, but I thought I would get your views on some of this....

Offline Ken2k7

  • Freak!
  • Posts: 5,174
    • View Profile
Re: What is the point of MD5?
« Reply #40 on: May 29, 2009, 11:10:37 AM »
It's SHA-256. Now I've already helped immensely :P

I'll let the offer stand though.
You sure don't seem concerned about losing $50 to someone who can guess it. :D
Quote from: Slaytanist
A programmer who shys away from elegant tricks will never be more than competent at best. Ego and a desire to attempt the impossible are traits of most great coders.

Offline neil.johnson

  • Guru
  • Fanatic
  • *
  • Posts: 3,416
  • Gender: Male
    • View Profile
Re: What is the point of MD5?
« Reply #41 on: May 29, 2009, 11:17:45 AM »
I'd offer more money. It's impossible!
Quote
To start, press any key. Where's the 'Any' key?

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: What is the point of MD5?
« Reply #42 on: May 29, 2009, 11:20:59 AM »
It's SHA-256. Now I've already helped immensely :P

I'll let the offer stand though.
You sure don't seem concerned about losing $50 to someone who can guess it. :D

It wouldn't matter. Even if you borrowed the local university's supercomputer you couldn't solve that task. I required a proof that the one you found is what I put into it. That is just not possible. Of course you might argue that if you find what I get you'll instantly see that it's the one(otherwise it would have to be an extraordinary coincidence), but that still wouldn't be a proof. I could offer $100, $1000 or even $1000000. It wouldn't matter because the task is impossible to solve.

Going with a mathematically much simpler hashing algorithm like GingerRobot mentioned earlier it might better illustrate the point. If we say that f(x)=x mod 10 we have a very simple hashing algorithm. So, f(0)=0, f(1)=1, f(2)=2, etc. However, f(10)=f(20)=f(-10)=0, f(11)=f(21)=f(-9)=1, f(12)=f(22)=f(-8)=2, and so on. I'm sure you can see the pattern. So essentially we have [tex]f : \mathbb{Z} \to \{x\in \mathbb{Z} \mid 0 \leq x < 9\}[/tex]. So if I tell you that my hash is 5, how are you going to find out if my input value was 5, 15, 25, 35, etc.? It just is not possible. You have no way of knowing if you got the correct one unless you already know the number from the start.

MD5 (and SHA-256 like I used) work in the same way. They all map an infinite number of items to a finite number of items, which quite obviously means that for each possible output value there is an infinite number of input values, or in other words there is an infinite number of hash collisions.

Because nobody can solve it, I might as well put up the solution. The code I wrote looks like this:

function generateRandom($length 32$extraChars false)
{
	
$chars '0123456789abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVW';
	
if (
$extraChars) {
	
	
$chars .= '_-+=%&*\'"`\\()~@{}[]<>,.?#| ';
	
}
	

	
for (
$i 0$charRange strlen($chars)-1$password ''$i $length$i++) {
	
	
$password .= $chars[mt_rand(0$charRange)];
	
}
	

	
return 
$password;
}

function 
hashPassword($password$salt$salt2)
{
	
$salt2Length strlen($salt2);
	

	
for (
$i 0$max strlen($password); $i $max$i++) {
	
	
$password[$i] = chr(ord($password[$i]) ^ ord($salt2[$i $salt2Length]));
	
}
	

	
return 
hash('sha256'$salt base64_encode($password));
}

$salt generateRandom(32true);
$salt2 generateRandom(32true);
$password 'goodJob';
$hash hashPassword($password$salt$salt2);

echo 
"Salt: {$salt}\nSalt 2: {$salt2}\nPassword: {$password}\nHash: {$hash}";


And the output was:
Quote
Salt: mU`Bz%4L75{vG0q? D?1[7C}r=G\T],y
Salt 2: B[#&}g-KJCs"p86[2]"NjEThO=TH'3Ef
Password: goodJob
Hash: 9f65f29197e64cef1f862f359866c3abdc473da40a0efd1f6 bca32fb13cfb5da

So rv20, you most certainly cannot decrypt/crack/brute-force/whatever a hash. My sister once asked me what you can use mathematics for. I suppose one application is that an understanding of it makes sure you won't look like a fool when you persistently claim that hashing can be "cracked".
« Last Edit: May 29, 2009, 11:31:31 AM by Daniel0 »

Offline rv20Topic starter

  • Enthusiast
  • Posts: 105
    • View Profile
Re: What is the point of MD5?
« Reply #43 on: May 29, 2009, 12:15:35 PM »
I don't understand your point with the sha-256, to me you would be as well with a random number as that is what it seems to output.

So i take it you can't use the sha hashing method to store passwords as how can you compare hashes for passwords if this sha-256 gives a different hash values for the same password each time it is run?

I think my point it totally valid, if someone hashes a password with md5 then all you need to do is run a brute forcer and compare each hash generated by the brute force method to the hash you have, i don't see the problem of calling that cracking.

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: What is the point of MD5?
« Reply #44 on: May 29, 2009, 12:19:02 PM »
I don't understand your point with the sha-256, to me you would be as well with a random number as that is what it seems to output.

So i take it you can't use the sha hashing method to store passwords as how can you compare hashes for passwords if this sha-256 gives a different hash values for the same password each time it is run?

My script produces random output because I give it random input. If you use the same input you'll get the same output. Try it out.

I think my point it totally valid, if someone hashes a password with md5 then all you need to do is run a brute forcer and compare each hash generated by the brute force method to the hash you have, i don't see the problem of calling that cracking.

Then you probably need to work on your math skills. Do you understand the post I just wrote? If foo => baz and bar => baz and I just tell you "baz". How are you going to know if I had "foo" or "bar"?
« Last Edit: May 29, 2009, 12:19:55 PM by Daniel0 »