Skip to content

Replace PyCrypto with PyCryptoDome#26

Open
KyleKing wants to merge 8 commits intoandrewcooke:masterfrom
KyleKing:master
Open

Replace PyCrypto with PyCryptoDome#26
KyleKing wants to merge 8 commits intoandrewcooke:masterfrom
KyleKing:master

Conversation

@KyleKing
Copy link

@KyleKing KyleKing commented Apr 15, 2020

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

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!

@zmarffy
Copy link

zmarffy commented Jan 24, 2021

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

@KyleKing
Copy link
Author

KyleKing commented Jan 24, 2021

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)

@zmarffy
Copy link

zmarffy commented Jan 28, 2021

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

@KyleKing
Copy link
Author

KyleKing commented Feb 12, 2021

@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
Copy link
Author

KyleKing commented Dec 20, 2023

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

@KyleKing
Copy link
Author

Still ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants