Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ImportError for AES Cipher in Crypto.Cipher #10

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

CorentinMre
Copy link
Contributor

Hello,

I've encountered an issue where the current implementation using Crypto.Cipher does not work with my Python version. To address this, I propose a backward-compatible change that attempts to import AES from Crypto.Cipher and falls back to Cryptodome.Cipher if the former is unavailable.

Here is the change I made:

try:
    from Crypto.Cipher import AES
except ImportError:
    from Cryptodome.Cipher import AES

This modification ensures compatibility for environments where Crypto.Cipher is not supported while maintaining functionality for those where it is. I've tested this change in my environment, and it resolves the issue without affecting the existing behavior.

@Zai-Kun Zai-Kun merged commit 5364663 into Zai-Kun:main Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants