re-implemented encrypt/decrypt functions using pycrypto