[New-bugs-announce] [issue20446] ipaddress: hash similarities for ipv4 and ipv6
report at bugs.python.org
Thu Jan 30 14:02:08 CET 2014
New submission from flambda:
I am a bit unsure if this is a problem but bear with me:
Using ipaddress I noticed that:
hash(ipaddress.ip_address("0.0.0.1")) == hash(ipaddress.ip_address("::1"))
which makes sense as ipaddress uses this:
as the hash.
This means that in a mixed environment (ipv4 and ipv6 addresses), hashtables with hash(hex(int(b))), int(b)<2**32 will be filled more then tables with int(b)>2**32 due to the ipv4 and ipv6 address space overlapping in the first 32bits.
If this is intended behaviour, I am sorry to have bothered you.
Have a nice evening.
components: Interpreter Core
title: ipaddress: hash similarities for ipv4 and ipv6
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce