I'm running a basic crypto program written in Python, and while it worked fine on OS X, I cannot get it to run on Windows (either in 3.6/Anaconda that was installed with VS 2017 when I checked in the setup that I wanted Python installed, and in a standalone 3.4 binary install).
Like individually each import statement works in the interpreter, but as a whole this program doesn't work
from hashlib import sha256
from pbkdf2_ctypes import *
import hmac
import hashlib
import binascii
from os import urandom
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
import getpass
masterpassword = "thisisamasterpassword"
salt = urandom(16)
masterpassword = pbkdf2_hex(masterpassword.encode('utf-8'), salt)
password = masterpassword.decode()
salt = binascii.hexlify(salt)
salt = salt.decode()
print(masterpassword)
The result is:
C:\Users\me\Desktop>py -3.4 masterpassword.py
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pbkdf2_ctypes.py", line 127, in <module>
raise OSError('Library not found')
OSError: Library not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "masterpassword.py", line 3, in <module>
from pbkdf2_ctypes import *
File "C:\Python34\lib\site-packages\pbkdf2_ctypes.py", line 153, in <module>
raise ImportError('Cannot find a compatible cryptographic library '
ImportError: Cannot find a compatible cryptographic library on your system
I also installed both an OpenSSL binary (https://slproweb.com/products/Win32OpenSSL.html) and made sure it was running under Anaconda.