homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
md5() hash
Up to 16 characters?
rokec




msg:3094944
 3:32 pm on Sep 24, 2006 (gmt 0)

I md5 hash is 32 hexa characters (16 values per char). That means 2 hexa characters (16*16=256) are for one "normal" character. By my calculating that is 16 bytes per md5 hash. Is that true?

 

ahmedtheking




msg:3095222
 9:33 pm on Sep 24, 2006 (gmt 0)

Bit of the old wiki can help: [en.wikipedia.org...]

coopster




msg:3095791
 11:35 am on Sep 25, 2006 (gmt 0)

Is this question being asked so you can determine how to store the md5 hash in a database? If so, a 32-character string is ideal.

rokec




msg:3097534
 2:19 pm on Sep 26, 2006 (gmt 0)

Yes, i know that - but can i store 146 (for example) chars long text to md5 hash?

Moosetick




msg:3097649
 3:25 pm on Sep 26, 2006 (gmt 0)

MD5 is a one way hash. You can store any length in a hash. You will always end up with a 32 character aplhanumeric string. You can not determine the original contents of that string from a hash value.

rokec




msg:3099568
 8:34 pm on Sep 27, 2006 (gmt 0)

But that means that two different strings MUST have same md5 hash.

barns101




msg:3099599
 9:05 pm on Sep 27, 2006 (gmt 0)

Yes, different strings can have the same MD5 hash.

coopster




msg:3100431
 1:42 pm on Sep 28, 2006 (gmt 0)

The term you are describing is collisions. I'm no mathematician but I do know there is something called combinatorics and if you search for the "Pigeonhole Principle" you'll find plenty of technical reading. In layman's terms, the Pigeonhole Principle says that if you have 13 pigeons but only 12 pigeonholes then at least one hole would contain at least two pigeons.

However, I think you can rest assured since, for a 16-byte hash, the odds of collision are extremely high -- 2^128

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved