[New-bugs-announce] [issue13710] hash() on string containing only null characters returns the length of the string

Ramchandra Apte report at bugs.python.org
Wed Jan 4 05:58:50 CET 2012


New submission from Ramchandra Apte <maniandram01 at gmail.com>:

If you run hash on strings containing only null characters it returns the length of the string
>>> hash("\0")
1
>>> hash("\0\0")
2
>>> hash("\0"*1000)
1000
This behaviour is not like proper hash functions.
The hashes of these strings should exhibit the avalanche effect like in a proper hash function.

----------
components: Interpreter Core
messages: 150587
nosy: ramchandra.apte
priority: normal
severity: normal
status: open
title: hash() on string containing only null characters returns the length of the string
type: behavior
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13710>
_______________________________________


More information about the New-bugs-announce mailing list