-
Notifications
You must be signed in to change notification settings - Fork 176
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
cipher: add encrypt/decrypt-only block cipher traits #352
cipher: add encrypt/decrypt-only block cipher traits #352
Conversation
Note: I used the new suggested method names here: Perhaps it would make more sense to leave them the same for consistency for now, then change them all in the next breaking release. |
0bf6fd0
to
59097cc
Compare
After a few attempts at eliminating the redundancy, I think it might make more sense to transform the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't Encrypt
/Decrypt
too generic? It could be worth to use something like BlockEncrypt
instead of block::Encrypt
. Such naming would also allow us to simplify the crate structure by removing stream
and block
modules.
That's a potential alternative, yes. I think it makes sense for the code to still be factored into two modules, but we could re-export everything at the toplevel rather than using modules. |
In 5096a41 I renamed the traits to |
I agree, I meant how API will look on outside. |
@newpavlov does this look ok now, or would you rather hold off until |
I think it will be better to release these changes in v0.3. |
Closes #349 Adds `Encrypt` and `Decrypt` traits which can be used in cases where e.g. only the encryption portion of a block cipher is used, as in CTR mode. This PR does not otherwise attempt to add things like a blanket impl.
Adds a single trait for carrying the `BlockSize` associated type/constant. Prefixes `Encrypt` and `Decrypt` traits with `Block*`, i.e. `BlockEncrypt` and `BlockDecrypt`.
5096a41
to
2c61ca2
Compare
@newpavlov I've gone ahead and made the discussed breaking changes (targeting This had the added benefit of eliminating the need for a |
2c61ca2
to
72593c0
Compare
Splits the `BlockCipher` impl into the `BlockEncrypt` and `BlockDecrypt` traits added in RustCrypto/traits#352.
Splits the `BlockCipher` impl into the `BlockEncrypt` and `BlockDecrypt` traits added in RustCrypto/traits#352.
Splits the `BlockCipher` impl into the `BlockEncrypt` and `BlockDecrypt` traits added in RustCrypto/traits#352.
Splits the `BlockCipher` impl into the `BlockEncrypt` and `BlockDecrypt` traits added in RustCrypto/traits#352.
Splits the `BlockCipher` impl into the `BlockEncrypt` and `BlockDecrypt` traits added in RustCrypto/traits#352.
Closes #349
Adds
BlockEncrypt
andBlockDecrypt
traits which can be used in cases where e.g. only the encryption portion of a block cipher is used, as in CTR mode.This PR does not otherwise attempt to add things like a blanket impl.