Skip to content

Conversation

@rozbb
Copy link
Contributor

@rozbb rozbb commented Jan 20, 2026

Deterministic encapsulation is super helpful for known-answer tests. I'm currently extending hpke to support X-Wing, and I need to be able to do deterministic encapsulation in order to check against the HPKE test vectors.

The randomness representation is the least controversial in my opinion. Rather than make it a 32-byte seed that gets expanded in some bespoke way, we make it 64 bytes. Thus, this API just exposes a passthrough to the underlying deterministic encapsulation methods. This happens to be how the hybrid KEM draft does this. If this changes in the future, that's fine, because this representation gives the caller full control.

Next steps

I think it'd be nice to move the EncapsulateDeterministic trait into traits/kem. Specifically I was thinking something like

pub trait EncapsulateDeterministic<EK, SS> {
    type Error: Debug;
    type RandomnessSize: ArraySize;

    fn encapsulate_deterministic(&self, randomness: &Array<u8, Self::RandomnessSize> -> Result<(EK, SS), Self::Error>;
}

@rozbb
Copy link
Contributor Author

rozbb commented Jan 20, 2026

Can't replicate the clippy error locally when running cargo clippy --all-features --all-targets -- -D warnings. Not sure what's happening

@rozbb
Copy link
Contributor Author

rozbb commented Jan 20, 2026

I'm just gonna remove the gate actually. This won't stay in this form for that long, since the trait will be upstreamed

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.

1 participant