diff --git a/aesutil.py b/aesutil.py index 67a3316..fd18ef1 100644 --- a/aesutil.py +++ b/aesutil.py @@ -1,9 +1,15 @@ -import Crypto.Hash.SHA256 -import Crypto.Cipher.AES +try: + import Crypto.Hash.SHA256 + import Crypto.Cipher.AES + has_aes = True +except: + has_aes = False class Crypter(object): ALIGNMENT = 16 def __init__(self, password, salt='aes.py'): + if not has_aes: + raise Exception("pycrypto not installed") self.password = password self.salt = salt self.hash = Crypto.Hash.SHA256.new(password + salt)