SCJP J2SE 1.4<br />SCBCD J2EE 1.3
Henry Wong wrote:Why not just use 16 out of the 20 bytes?
Henry
Elchin Asgarli wrote:
Henry Wong wrote:Why not just use 16 out of the 20 bytes?
Can't provide mathematical proofs though![]()
Pat Farrell wrote:
Elchin Asgarli wrote:
Henry Wong wrote:Why not just use 16 out of the 20 bytes?
Can't provide mathematical proofs though![]()
The math is described in the "Birthday paradox", google or wikipedia have links.
If you only need a limited range of hash values, just pull them out of the SHA results. You can truncate the return string, or pick a substring out of the center, makes no difference. There are many cases where a long hash value is not necessary
There is zero reason to do a MD5 of the SHA. Its bad form.
Elchin Asgarli wrote:I did not get it, the Birthday Paradox is in fact contrary to what you said about getting substring from the hash. Lets say checksum is a 'birthday' of the input string(or if you think other way around, birthday is log365 bit checksum of a person), so probability of getting collision is higher than it may first seem.
Pat Farrell wrote:
Elchin Asgarli wrote:I did not get it, the Birthday Paradox is in fact contrary to what you said about getting substring from the hash. Lets say checksum is a 'birthday' of the input string(or if you think other way around, birthday is log365 bit checksum of a person), so probability of getting collision is higher than it may first seem.
No, the birthday paradox explains exactly the math.
Then you have an engineering decision, what probability of collision is important to your application? You may not need the low probability of collision that the full SHA provides. If so, you can substring the results. And you don't have to guess, you can calculate the length you need for your requirements.
Doing a MD5 of a SHA1 yields only the MD5 collision strength, and MD5 is considered too weak for serious work. Doing the two step process is a waste of execution and programmer time.
Use a SHA, these days SHA256. Then truncate to suit your needs.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Henry Wong wrote:Arguing the merits of MD5 vs SHA1 vs MD5 of SHA1 seems silly to me.
Henry Wong wrote: Keep in mind that, if lucky, an average password has about 7 or 8 ascii letters. At 5 relevant bits per letter, this adds up to about 40 bits. Arguing about keeping the 160 bits vs dropping the security level down to 128 bits, is kinda silly, when the password is only about 40 relevant bits long.
Don't get me started about those stupid light bulbs. |