New submission from flambda:

Hi,

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:
(http://hg.python.org/cpython/file/default/Lib/ipaddress.py)
    def __hash__(self):
        return hash(hex(int(self._ip)))
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
messages: 209714
nosy: flambda
priority: normal
severity: normal
status: open
title: ipaddress: hash similarities for ipv4 and ipv6
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20446>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to