TypeError: 'hmac_hash_module' is an invalid keyword argument for pbkdf2_hmac()

69 Views Asked by At

I am trying to compute a master key with the pbkdf2_hmac. Please help me with the latest arguments that we need to pass in the pbkdf2_hmac for computing the key.

from hashlib import pbkdf2_hmac, sha512

def computeMasterKey(mp, ds):
    password = mp.encode()
    salt = ds.encode()
    key = pbkdf2_hmac(password, salt, 32, iterations=1000000, hmac_hash_module=sha512)
    return key

Error: TypeError: 'hmac_hash_module' is an invalid keyword argument for pbkdf2_hmac()

I tried the follwoing

1.

key = pbkdf2_hmac(password, salt, 32, iterations=1000000, hash_name=sha512)

Error: TypeError: argument for pbkdf2_hmac() given by name ('hash_name') and position (1)

2.

key = pbkdf2_hmac(password, salt, 32, iterations=1000000, algorithm=sha512)

Error: TypeError: 'algorithm' is an invalid keyword argument for pbkdf2_hmac()

3.


key = pbkdf2_hmac(password, salt, 32, iterations=1000000, hash_name='sha512')

Error: TypeError: argument for pbkdf2_hmac() given by name ('hash_name') and position (1)

Expectation: Please help me with the latest arguments that we need to pass in the pbkdf2_hmac for computing the key.

0

There are 0 best solutions below