[New-bugs-announce] [issue29535] datetime hash is deterministic in some cases

Armin Rigo report at bugs.python.org
Sat Feb 11 10:16:53 EST 2017


New submission from Armin Rigo:

The documentation on the hash randomization says that date, time and datetime have a hash based on strings, that is therefore nondeterministic in several runs of Python.  I may either be missing a caveat, or the actual implementation does not follow its promise in case a timezone is attached to the datetime or time object:

~/svn/python/3.7-debug/python -c "import datetime;print(hash(d                      atetime.datetime(2016,10,10,0,0,0,0,datetime.timezone(datetime.timedelta(0, 36000)))))"
(this gives -6021186165085109055 all the time)

~/svn/python/3.7-debug/python -c "import datetime;print(hash(datetime.time(0,0,0,0, datetime.timezone(datetime.timedelta(0, 36000)))))"
(this gives -3850122659820237607 all the time)

----------
messages: 287601
nosy: arigo
priority: normal
severity: normal
status: open
title: datetime hash is deterministic in some cases
type: security
versions: Python 3.5, Python 3.7

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


More information about the New-bugs-announce mailing list