0

I am running a Python application on a standard AWS CentOS instance. When the code tries to call hashlib.pbkdf2_hmac it raises an AttributeError exception. The code is as below:

import hashlib, binascii

hashed_password = binascii.hexlify(hashlib.pbkdf2_hmac(result.encryption_method, bytearray(password.encode('utf_32')), binascii.a2b_uu(result.salt), result.encryption_rounds))

I have run yum update in the hopes of updating Python 2.7 to the latest version, but this hasn't helped. Any help on how to get hashlib.pbkdf2_hmac?

David Poxon
  • 2,435
  • 4
  • 23
  • 44

1 Answers1

2

The pbkdf2_hmac was only just added to hashlib in Python 2.7.8 as part of PEP 466.

I suggest installing the python-passlib package instead and using passlib as CentOS doesn't have Python 2.7.8.

gps
  • 1,360
  • 12
  • 12