Mar-21-2018, 11:37 AM
Hi there - first post from a Python noob.
I'm trying to understand why some code in Python 2.7 works, yet when I try to port it across to Python 3.5 does not.
In Python 2.7
In Python 3.5
Any help would be much appreciated. I am really stumped on this.
R.
I'm trying to understand why some code in Python 2.7 works, yet when I try to port it across to Python 3.5 does not.
In Python 2.7
import hashlib key = 'c41d9eac' print(hmac.new(key, 'this is the life', hashlib.sha1).hexdigest())>>> 537e629995a1ddd6c701c8b3563d06971a5cf751
In Python 3.5
import hashlib key = 'c41d9eac' print(hmac.new(b'key', b'this is the life', hashlib.sha1).hexdigest())>>> e4b48f8bc8aa40fbc59fd88deb76bf4fc5e9b645
Any help would be much appreciated. I am really stumped on this.
R.