Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So I initially was only editing the random mode to the pyCrypto
Crypto.Random.random
method, when I noticed that the pycrypto defaults to ECB mode, which is sort of bad (I opened issue #27 which explains in a bit more detail why)Rather than just offer a problem and not a solution, I edited the library to support better block cipher modes while retaining backwards compatibility, by allowing a field attribute
block_type
to be set, and using the better block ciphers only if that is set.I also added a bit to the tests to test that this does in fact work as intended, and all existing tests pass.
I'd highly recommend a roadmap that eventually phases out the old behavior and makes the CBC mode default, but I figured invalidating everyone's data abruptly was a bad way to go about it.
Previous request:
The pyCrypto library includes a random method that's supposedly more "cryptographically secure" than the python random library.
I updated the imports to use this library instead of the python one.