Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hash v2 and v3 help
#1
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
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.
Reply


Messages In This Thread
hash v2 and v3 help - by Normalitie - Mar-21-2018, 11:37 AM
RE: hash v2 and v3 help - by DeaD_EyE - Mar-21-2018, 01:20 PM
RE: hash v2 and v3 help - by ODIS - Mar-21-2018, 01:26 PM
RE: hash v2 and v3 help - by DeaD_EyE - Mar-21-2018, 01:32 PM
RE: hash v2 and v3 help - by ODIS - Mar-21-2018, 01:41 PM
RE: hash v2 and v3 help - by Normalitie - Mar-22-2018, 01:21 PM
RE: hash v2 and v3 help - by Normalitie - Mar-22-2018, 03:31 AM
RE: hash v2 and v3 help - by DeaD_EyE - Mar-22-2018, 01:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] How to crack hash with hashlib Milan 0 1,441 Mar-09-2023, 08:25 PM
Last Post: Milan
  Hash command works differently for me in CMD and Spyder ZweiDCG 3 2,378 Sep-10-2019, 01:10 PM
Last Post: DeaD_EyE
  length constraint on phrase hash to password javaben 0 1,929 Aug-21-2019, 05:34 PM
Last Post: javaben
  Create file archive that contains crypto hash ED209 1 2,069 May-29-2019, 03:05 AM
Last Post: heiner55
  Fastest dict/map method when 'key' is already a hash? tasket 6 4,042 Apr-20-2019, 06:40 PM
Last Post: tasket
  how to generate sha256 hash for each line of my txt file | using python version 3.6.4 rajtekken5 2 9,128 Feb-11-2018, 01:41 PM
Last Post: rajtekken5
  virtualenv activate.ps1 hash error po20 2 3,851 Jan-13-2018, 09:21 AM
Last Post: po20
  Hash function in Python rachelrosemond 3 4,069 Sep-29-2017, 02:57 PM
Last Post: ichabod801
  Python Hash list check here2learn 4 5,431 Feb-27-2017, 08:35 PM
Last Post: here2learn
  fast hash function verstapp 3 6,080 Dec-13-2016, 07:10 PM
Last Post: verstapp

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020