Uniquely identifying each & every html template

Chris Angelico rosuav at gmail.com
Thu Jan 24 00:25:58 CET 2013

On Wed, Jan 23, 2013 at 11:38 PM, Dave Angel <d at davea.name> wrote:
> You think it's an accident that md5 size is roughly equivalent to 39 decimal
> digits?  Or that the ones that haven't been proven insecure are much larger
> than that?  The sha512 hash is roughly equivalent to 154 decimal digits.

Proving a hash function secure or not is orthogonal to its length. You
could have a cryptographically secure hash function that produces a
single byte; you'd get collisions pretty often, but that's understood.
Conversely, you could have an insecure hash that produces a value
several orders of magnitude longer than SHA512. Look at this:

def big_long_hash(val):
    return sum(bytes(str(val),"utf-8"))*12345678901234567890

But longer hashes do reduce the chance of collisions, by the
fundamental rules of mathematics.


More information about the Python-list mailing list