Skip to content

Conversation

@newpavlov
Copy link
Member

@newpavlov newpavlov commented Jan 30, 2026

The methods were intended to be used for the ECB mode, but they are hard to discover in practice for inexperienced users, so I plan to introduce a separate crate for the mode.

Closes #2129

@newpavlov
Copy link
Member Author

newpavlov commented Jan 30, 2026

@tarcieri
WDYT about the remaining methods? While they are convenient and probably expected by users, they are problematic since relying on them results in potential backend branching on each method call, which can be quite sub-optimal. In particular, a number of AEAD crates suffer from that.

I wonder if we should keep only encrypt/decrypt_with_backend methods to force users to properly handle block cipher implementations with multiple backends selected at runtime.

@newpavlov newpavlov merged commit 176efb8 into master Jan 30, 2026
11 checks passed
@newpavlov newpavlov deleted the cipher/rm_padded branch January 30, 2026 21:26
@tarcieri
Copy link
Member

I'll say it's a little strange our block cipher traits don't provide the API typically provided by block ciphers whatsoever, but only somewhat arcane performance-oriented APIs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cipher: simplify BlockCipherEncrypt/Decrypt traits?

3 participants