On 01/22/2013 01:37 PM, Ferrous Cranus wrote:
<snip>
==============================================
pin = int( htmlpage.encode("hex"), 16 ) % 10000
==============================================
Can you please explain the differences to what you have posted opposed to this
perl coding?
==============================================
foreach my $ltr(@ltrs){
$hash = ( $hash + ord($ltr)) %10000;
==============================================
I want to understand this and see it implemented in Python.
The perl code will produce the same hash for "abc.html" as for
"bca.html" That's probably one reason Leonard didn't try to
transliterate the buggy code.
In any case, the likelihood of a hash collision for any non-trivial
website is substantial. As I said elsewhere, if you hash 100 files you
have about a 40% chance of a collision.
If you hash 220 files, the likelihood is about 90%
--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list