You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a few attempts at eliminating the redundancy, I think it might make more sense to transform the BlockCipher trait (via a breaking change) into a marker trait for the case where a type impls both Encrypt and Decrypt with compatible BlockSize/ParBlocks.
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.
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 BlockEncrypt and BlockDecrypt, and added a BlockSizeMarker trait for carrying the BlockSize associated type/constant.
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`.
@newpavlov I've gone ahead and made the discussed breaking changes (targeting cipher v0.3) in 2c61ca2, including splitting BlockCipherMut into BlockEncryptMut and BlockDecryptMut which require the given type impls BlockCipher.
This had the added benefit of eliminating the need for a stream::FromBlockCipherMut trait.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Closes#349
Adds
BlockEncryptandBlockDecrypttraits 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.