TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech World > Technical Discussions > Tech Reference

Notices

Reply
 
Thread Tools Display Modes
Old 26-01-2007, 08:22 PM   #1
Regular Member (100+)
 
ZyanWu's Avatar
 
Join Date: Dec 2006
Location: At home
Posts: 141
Thanks: 46
Thanked 3 Times in 3 Posts
Rep Power: 3 ZyanWu will become famous soon enough
What's a MD5 hash???

What's a MD5 hash???
__________________

“Hell begins on the day God grants us a clear vision
of all that we might have achieved,
of all the gifts which we have wasted,
of all that we might have done which
- we did not do -
”
ZyanWu is offline   Reply With Quote
Old 26-01-2007, 09:00 PM   #2
ƒ(ψ)=ΘΊΧφ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 22
Posts: 5,032
Thanks: 12
Thanked 392 Times in 362 Posts
Rep Power: 69 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future
Send a message via Yahoo to bakuryu
Re: What's a MD5 hash???

MD5

MD5 (Message-Digest algorithm 5) is a widely used cryptographic hash function with a 128-bit hash value. An MD5 hash is typically a 32-character hexadecimal number.
__________________
Please don't click here
bakuryu is online now   Reply With Quote
Old 26-01-2007, 09:06 PM   #3
Regular Member (100+)
 
ZyanWu's Avatar
 
Join Date: Dec 2006
Location: At home
Posts: 141
Thanks: 46
Thanked 3 Times in 3 Posts
Rep Power: 3 ZyanWu will become famous soon enough
Re: What's a MD5 hash???

And how do i use it to verify files?
__________________

“Hell begins on the day God grants us a clear vision
of all that we might have achieved,
of all the gifts which we have wasted,
of all that we might have done which
- we did not do -
”
ZyanWu is offline   Reply With Quote
Old 26-01-2007, 09:53 PM   #4
Founder
 
Strider's Avatar
 
Join Date: Nov 2005
Location: The Last City Zion!
Posts: 2,684
Thanks: 228
Thanked 230 Times in 191 Posts
Rep Power: 53 Strider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just Great
Re: What's a MD5 hash???

Every file will have a unique MD5 hash. Change in even a single byte of the file will change the MD5 value. So it can be used for verifying file integrity.

Download a freeware MD5 calculator here:
MD5 Calculator
Strider is offline   Reply With Quote
Old 26-01-2007, 09:58 PM   #5
Regular Member (100+)
 
ZyanWu's Avatar
 
Join Date: Dec 2006
Location: At home
Posts: 141
Thanks: 46
Thanked 3 Times in 3 Posts
Rep Power: 3 ZyanWu will become famous soon enough
Re: What's a MD5 hash???

Quote:
Originally Posted by Strider View Post
Every file will have a unique MD5 hash. Change in even a single byte of the file will change the MD5 value.

So... why can't we compress huge files into one string and use it instead of the big one?
__________________

“Hell begins on the day God grants us a clear vision
of all that we might have achieved,
of all the gifts which we have wasted,
of all that we might have done which
- we did not do -
”
ZyanWu is offline   Reply With Quote
Old 26-01-2007, 10:31 PM   #6
ƒ(ψ)=ΘΊΧφ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 22
Posts: 5,032
Thanks: 12
Thanked 392 Times in 362 Posts
Rep Power: 69 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future
Send a message via Yahoo to bakuryu
Re: What's a MD5 hash???

have u read the algorithm ?? it's not such a easy task
bakuryu is online now   Reply With Quote
Thanked Users:
Night_virus (27-01-2007)
Old 26-01-2007, 10:54 PM   #7
Founder
 
Strider's Avatar
 
Join Date: Nov 2005
Location: The Last City Zion!
Posts: 2,684
Thanks: 228
Thanked 230 Times in 191 Posts
Rep Power: 53 Strider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just Great
Re: What's a MD5 hash???

Quote:
So... why can't we compress huge files into one string and use it instead of the big one?
It's not about compressing. It's a unique checksum of all the bytes of the files calculating through a complex MD5 hashing algorithm. That value can assure you that the file is original or malformed.

eg. For the file MD5.exe the unique hash value is 7480640e9e85b3b9de7afe4f0c400d5e.

Strider is offline   Reply With Quote
Thanked Users:
Night_virus (27-01-2007)
Old 27-01-2007, 07:01 AM   #8
Elite Member (1000+)
 
Night_virus's Avatar
 
Join Date: Jul 2006
Location: Kolhapur, India
Age: 17
Posts: 1,114
Thanks: 69
Thanked 47 Times in 45 Posts
Rep Power: 17 Night_virus is a glorious beacon of lightNight_virus is a glorious beacon of lightNight_virus is a glorious beacon of lightNight_virus is a glorious beacon of lightNight_virus is a glorious beacon of light
Send a message via MSN to Night_virus Send a message via Yahoo to Night_virus
Re: What's a MD5 hash???

thnx all re....
i didnt know tht...
Night_virus is offline   Reply With Quote
Old 27-01-2007, 03:47 PM   #9
Junior Member (25+)
 
anniepoo's Avatar
 
Join Date: Oct 2006
Posts: 48
Thanks: 20
Thanked 5 Times in 4 Posts
Rep Power: 0 anniepoo is an unknown quantity at this point
why won't a digest hash code compress?

"So... why can't we compress huge files into one string and use it instead of the big one?"

MD5 is an example of a hash code. Suppose you're going to keep track of student records for a few hundred students in a school using file folders and paper (gasp!)

To make it quicker to find records, you set up a file cabinet with those divider things and file each students folder under their last name in the appropriate
cubbyhole. If you have 200 students you have an *average* of 8 folders per cubbyhole.

But when you try this you discover that something's wrong. There are lots of P's, R's, and V's, but not many 'nya's' , 'zh's - so you're still looking through lots of folders to find students named Varma.

So instead you make some complicated crazy function. Exactly what it is isn't important, only that, when you stick a name in it gives a letter back that is randomly distributed in the alphabet. And every time you put in the same name, you get the same letter out. Call that function F

Now, put the folder for Varma in whatever letter F("Varma") is

We call F a hash function.

Now, after we put all the folders in their new locations, we have an equal distribution of items in the cubbyholes.

That's one of many cool uses of a hash function. Another one is figuring out whether two things are equal. Suppose Strider decides that no two people can use the same avatar on Techtalkz. That'd be really computationally intensive to check by brute force.
Here's a fast way to do it.
Construct a hash function that maps an image into a number. Lets say it maps into 10 bits. Then we have an array bucket[1024]. We look through all the images. Compute the hash code and look in the bucket[hachscode(image)]. Now, it might be that two different images have the same hashcode. But it's pretty easy to check the few images in that bucket. If non are identical, we add this one to the bucket, and go to the next image.
Java, for example, keeps a hash code for each object, and when you do
foo.equals(bar), it checks whether the hash codes are equal (few caveats here, this isn't an essay on Java hashcodes)

So, the MD5 digest is a hash code whose input is a whole file and whose output is some hex number.
Suppose D1pSh1T the cracker wants to act cool by causing you grief. He gets on dad's computer and writes a program that erases your hard drive or something. He also writes some stupid little utility that shows JPG's or something, and uploads this to tucows. Tucows decides it's not a virus and puts it on their site, with a pointer to D1pSh1T's web page.
Now D1pSh1T puts the destructive Trojan where the innocent utility was. You download it, run it, and your day is ruined.
How to protect yourself?
Tucow, when they decide 'Super JPG viewer' isn't a Trojan Horse, computes the MD5 hash, and publishes this along with the link to where you can download it. Lets say it's 2342AE239800AC1244FF1136CA1288FF

Now, you download what you think is Super JPG viewer, but is really the trojan. But, being careful, you run it through a program that computes the MD5 checksum, and...gasp... it's a different number. So you know you're dealing with a computer criminal.

So, why can't we use the hash to compress files? Because, despite there being 2^128 possible MD5 values, there are 2^2^15 possible 32K long files, and 2^2^15 is a MUCH larger number than 2^128. So there are some 2^32640 files for each possible MD5 value. The decompressor would have no way of choosing among them.


anniepoo is offline   Reply With Quote
Thanked Users:
Strider (27-01-2007)
Old 27-01-2007, 03:57 PM   #10
Regular Member (100+)
 
ZyanWu's Avatar
 
Join Date: Dec 2006
Location: At home
Posts: 141
Thanks: 46
Thanked 3 Times in 3 Posts
Rep Power: 3 ZyanWu will become famous soon enough
Re: What's a MD5 hash???

Yea... i've got it... it's just like the compiler sums up 2 and 3... gets 5... but the decompiler doesn't know how to put the bytes back: 0 and 5 / 1 and 4 / 2 and 3 etc... i getit!
Also... this means that not every file has it's unique hash... 2^32640 files can have the same MD5 hash... but a different content... doesn't this mean that with a little bit of work a MD5 calculator can be tricked?
ZyanWu is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Google
 


All times are GMT +5.5. The time now is 02:09 PM.


vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2008, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional