~kf5jwc/cryptopals-challenges

Challenge 18, CTR decryption
6093e1ec — Kyle Jones 1 year, 17 days ago
Implement CTR mode oracle
1d69748f — Kyle Jones 1 year, 17 days ago
Implement CTR mode
2c109bb3 — Kyle Jones 1 year, 17 days ago
Test fix: Mask is calculated, not iterated naively

The previous test expected simple +1 rolled values, but the mask stages calculate the plaintext byte and then produce a new value for the stage.
So, wow, that was a lot of learning.

The mask itself isn't important. The mask can be calculated on the fly every time you want to create it (though caching would probably be an improvement) so that you don't need to guess the right bit flip to +1 the value; the plaintext value can be directly xor'd with the desired value because the operations I insert are commutative.

Also I picked a fairly roundabout way to implement the block breaker and mask.
c86f25b9 — Kyle Jones 1 year, 18 days ago
Add a decryption method which accepts a mask

This makes it simpler to centralize the key data
6673e042 — Kyle Jones 1 year, 18 days ago
Bugfix: zero-length padding is invalid.
e732fe15 — Kyle Jones 1 year, 18 days ago
Give a better response when invalid padding is found for the sake of challenges
ee4e1977 — Kyle Jones 1 year, 19 days ago
Expand the traits available on oracles

I got overzealous when needing to expose the CBC IV.

I can't simply mark the IV as `pub`, since that allows external modification.
f4f6b290 — Kyle Jones 1 year, 1 month ago
Challenge 16 fix

Ordering of encodings is important.
A working CBC padding attack :o
a55d4cc8 — Kyle Jones 1 year, 1 month ago
Implement DecryptionOracle trait
391497fb — Kyle Jones 1 year, 1 month ago
Improve testing to solve full-block padding
44932737 — Kyle Jones 1 year, 1 month ago
Using an enum is a clearer indication of error
So, the challenge-12 solution works for #14 too.
e1239760 — Kyle Jones 1 year, 1 month ago
Small change, unchecked Result fix
2ccac28a — Kyle Jones 1 year, 1 month ago
Use u8 when padding block, per last change reasoning
1f828554 — Kyle Jones 1 year, 1 month ago
The block lengths should be computable within u8's
Split out the padding validation
Split out randomness() to be a dep
Next