RustCrypto / RustCrypto/traits
crypto-common: potential future of `KeyIvInit` for `T: InnerInit` where `T::Inner: KeyIvInit`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 755
- Forks
- 256
- Avg merge
- 1h 27m
- Merged PRs (30d)
- 2
Description
Moving this commented out code from the crypto-common source to a tracking issue:
Unfortunately this blanket impl is impossible without mutually exclusive traits, see:
https://github.com/rust-lang/rfcs/issues/1053or at the very least without:
https://github.com/rust-lang/rust/issues/20400
impl<T> KeyIvInit for T
where
T: InnerInit,
T::Inner: KeyIvInit,
{
#[inline]
fn new(key: &Key<Self>, iv: &Iv<Self>) -> Self {
Self::inner_init(T::Inner::new(key, iv))
}
#[inline]
fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength> {
T::Inner::new_from_slice(key)
.map_err(|_| InvalidLength)
.map(Self::inner_init)
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the commented-out KeyIvInit implementation in the crypto-common source and review the linked Rust RFC and issue about mutually exclusive traits and specialization. Determine whether current Rust trait capabilities permit this blanket implementation; done requires a documented, feasible resolution rather than merely restoring the commented code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100