Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Sat Mar 19 08:24:33 CDT 2011
Hi Stuart -- <<< It looks as though you created 6 million random strings and four of them turned out to be identical. >>> No, all SHA1 strings are different - these are 64 bit hashes of that strings, which have got some collisions. Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: 19 ????? 2011 ?. 16:20 To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] SHA1 to compute a hash If he is compacting a 160 bit hash to a 64 bit hash, he is certainly increasing the odds of a collision - but I suspect that even at 64 bits, the chances of a collision would be very low. But that does not appear to be what you are testing. It looks as though you created 6 million random strings and four of them turned out to be identical. Therefore also had the same SHA1 digest. What happens if you try it again, making sure that all of your strings are unique. Alternatively, what do you get if you add some code to show the pairs of strings. Are they different? -- Stuart On 19 Mar 2011 at 16:03, Shamil Salakhetdinov wrote: > Hi Stuart and John, > > <<< > AFAIK, no one other than you has found any > >>> > Yes, I was also confused how it comes to get SHA1 hashes collisions > but then I have thought that John probably "compacts" SHA1 hashes into > 8 bytes surrogate keys? > > Here (P.S.) is a "quick&dirty" "brute force" test code - 4 collisions > for 6 millions cycles for 8 bytes keys. > > Please correct me if you find some errors in my sample code > > Thank you. > > -- > Shamil > <<< snip >>>