btcrecover
btcrecover copied to clipboard
Use PyCryptodome instead of PyCrypto
This pull request is motivated by #165 which lets users install PyCryptodome
instead of the now inactive PyCrypto
package. Since PyCryptodome
installs all modules under the same Crypto
package that PyCrypto
used, all I had to do was change the references and documentation throughout the project. No actual code, including variables and functions had to be changed.
However, what I have used here is a "drop-in replacement" of PyCrypto
, which allows us to not make any changes to the code and continue to use the same Crypto
package as mentioned earlier. PyCryptodome
offers another library independent of the old PyCrypto
and can be installed as PyCryptodomex
, where all modules are installed under the Cryptodome
package.
With this pull request, old users of btcrecover
who don't install PyCryptodome
will not be affected (at least, immediately), but if we go the other route of using PyCryptodomex
and changing the code to use Cryptodome
instead of Crypto
, then they will be forced to install it in order to use btcrecover
.
These are my thoughts on this, would love any suggestions.
Hi @sunnyville01. First off, thanks so much for taking the time to write all this new documentation up! I would love to merge it and to get away from PyCrypto... but unfortunately PyCrypto remains a lot faster than other easy-to-install alternatives that I've been able to find.
In particular, in my testing PyCrypto makes btcrecover about 3 times faster with "fast" wallets like MultiBit Classic vs. PyCryptodome. Here are is some basic profile testing I did (on a system with AES-NI), PyCrypto is first:
And PyCryptodome next:
In particular, the time required to create a new decryption object (setting the key and IV) is much slower with PyCyrptodome. It may very well be that PyCyrptodome is faster for decrypting large chunks of data, but btcrecover only decrypts two or three 16-byte blocks per key, so for btcrecover's use case, PyCrypto works a lot better at least for the time being....
Seems this should be closed?