comparison MoinMoin/action/cache.py @ 6128:561b7a9c2bd9

fix wrong digestmod of hmac.new calls stdlib default is md5, but we need sha1. this bug was introduced when removing python_compatibility module usage in changeset 500f68d3e2fd594b2f4ea4a272b828a07d9eac1d.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 01 Nov 2016 17:56:32 +0100
parents 500f68d3e2fd
children
comparison
equal deleted inserted replaced
6127:af23cef9675c 6128:561b7a9c2bd9
26 @copyright: 2008 MoinMoin:ThomasWaldmann 26 @copyright: 2008 MoinMoin:ThomasWaldmann
27 @license: GNU GPL, see COPYING for details. 27 @license: GNU GPL, see COPYING for details.
28 """ 28 """
29 29
30 from datetime import datetime 30 from datetime import datetime
31 import hmac 31 import hmac, hashlib
32 32
33 from MoinMoin import log 33 from MoinMoin import log
34 logging = log.getLogger(__name__) 34 logging = log.getLogger(__name__)
35 35
36 # keep both imports below as they are, order is important: 36 # keep both imports below as they are, order is important:
97 hmac_data = u''.join([wikiname, itemname, attachname, repr(fuid)]) 97 hmac_data = u''.join([wikiname, itemname, attachname, repr(fuid)])
98 else: 98 else:
99 raise AssertionError('cache_key called with unsupported parameters') 99 raise AssertionError('cache_key called with unsupported parameters')
100 100
101 hmac_data = hmac_data.encode('utf-8') 101 hmac_data = hmac_data.encode('utf-8')
102 key = hmac.new(secret, hmac_data).hexdigest() 102 key = hmac.new(secret, hmac_data, digestmod=hashlib.sha1).hexdigest()
103 return key 103 return key
104 104
105 105
106 def put(request, key, data, 106 def put(request, key, data,
107 filename=None, 107 filename=None,