simple-crypt icon indicating copy to clipboard operation
simple-crypt copied to clipboard

Replace PyCrypto with PyCryptoDome

Open KyleKing opened this issue 4 years ago • 5 comments

This PR replaces the pyCrypto dependency with the actively maintained (and backward compatible) pyCryptoDome. See discussion on EOL for PyCrypto

  • Fixes #17
  • FIxes #20
  • Fixes #21
  • Fixes #27
  • Fixes #28
  • Alternative to PR #22 and #24
    • The fork for PR #22 appears to be deleted and can't be merged
    • I didn't see #24 before creating this PR, but this PR goes a little farther and updates documentation, etc.

All tests pass; however, I had to skip a test that called a feature of pyCrypto (ctr()) that was changed in pyCryptoDome. If this PR will be merged, I can spend some time to figure out how to re-implement that test

❯ nosetests -x
.....................
----------------------------------------------------------------------
Ran 21 tests in 437.129s

OK

Update: I'll keep my fork live and will accept PRs. You can install the package from my fork with:

pip install git+https://github.com/KyleKing/simple-crypt.git

I've been using the fork for almost a year in Python 3.9 and 3.6 with backward compatibility with the official simple-crypt 4.1.7 in a Python 2.7 project without issue. Hopefully, these changes can be merged and released so others can benefit!

KyleKing avatar Apr 15 '20 22:04 KyleKing

Doesn't seem to work on 3.9. ModuleNotFoundError: No module named 'Crypto'.

zmarffy avatar Jan 24 '21 19:01 zmarffy

Can you check that crypto and pycrypto are uninstalled? If not, can you send me the full stack trace? I tested locally in a new venv with Python 3.9.0 on Mac and was able to run the below script

# check_imports.py
from simplecrypt import encrypt, decrypt

password = 'pass'
ciphertext = encrypt(password, 'my secret message')
plaintext = decrypt(password, ciphertext)
print(ciphertext, plaintext)

KyleKing avatar Jan 24 '21 21:01 KyleKing

@KyleKing I'm dumb. Had the extra stuff installed. Thanks. Good stuff.

zmarffy avatar Jan 28 '21 00:01 zmarffy

@andrewcooke can you please take a look and consider merging this change?

I need to use simple-crypt in a project with Python ^3.8 that is backward compatible with files encrypted with simple-crypt 4.1.7

KyleKing avatar Feb 12 '21 14:02 KyleKing

This PR is still ready for review/merge/release if there is any interest!

KyleKing avatar Dec 20 '23 14:12 KyleKing