Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hash v2 and v3 help
#7
(Mar-21-2018, 01:41 PM)ODIS Wrote: You're right.

I think the problem is that he's converting to the bytes the "key" string instead of "c41d9eac" :)

Thanks. This was indeed the problem.
Original:
import hashlib
key = 'c41d9eac'
print(hmac.new(b'key', b'this is the life', hashlib.sha1).hexdigest())
Solution:
import hashlib
key = b'c41d9eac'
raw = 'this is the life'
print(hmac.new(key, raw.encode(), hashlib.sha1).hexdigest())
Thanks again for your help.

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,487 Mar-09-2023, 08:25 PM
Last Post: Milan
  Hash command works differently for me in CMD and Spyder ZweiDCG 3 2,408 Sep-10-2019, 01:10 PM
Last Post: DeaD_EyE
  length constraint on phrase hash to password javaben 0 1,953 Aug-21-2019, 05:34 PM
Last Post: javaben
  Create file archive that contains crypto hash ED209 1 2,085 May-29-2019, 03:05 AM
Last Post: heiner55
  Fastest dict/map method when 'key' is already a hash? tasket 6 4,079 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,156 Feb-11-2018, 01:41 PM
Last Post: rajtekken5
  virtualenv activate.ps1 hash error po20 2 3,876 Jan-13-2018, 09:21 AM
Last Post: po20
  Hash function in Python rachelrosemond 3 4,097 Sep-29-2017, 02:57 PM
Last Post: ichabod801
  Python Hash list check here2learn 4 5,467 Feb-27-2017, 08:35 PM
Last Post: here2learn
  fast hash function verstapp 3 6,134 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