Skip to content

Encrypt directly into the output buffer in HPKE#14948

Merged
reaperhulk merged 1 commit into
mainfrom
claude/eloquent-shannon-6eD76
Jun 6, 2026
Merged

Encrypt directly into the output buffer in HPKE#14948
reaperhulk merged 1 commit into
mainfrom
claude/eloquent-shannon-6eD76

Conversation

@alex
Copy link
Copy Markdown
Member

@alex alex commented Jun 4, 2026

Instead of having the AEAD encrypt into a fresh PyBytes and then copying the ciphertext into the enc || ct output buffer, Suite::encrypt_inner now allocates the final output buffer up front, copies enc into the front, and encrypts directly into the remainder via the AEADs' encrypt_into — avoiding an allocation and a copy of the ciphertext.

To support this, AesGcm::encrypt_into and ChaCha20Poly1305::encrypt_into are now pub(crate).

https://claude.ai/code/session_011Eb7821FTtj3vMYwxsr4En


Generated by Claude Code

Instead of having the AEAD encrypt into a fresh PyBytes and then
copying the ciphertext into the enc || ct output buffer, write the
ciphertext directly into the output buffer using the AEADs'
encrypt_into, avoiding an allocation and a copy.

https://claude.ai/code/session_011Eb7821FTtj3vMYwxsr4En
@reaperhulk reaperhulk merged commit f28cd46 into main Jun 6, 2026
64 checks passed
@reaperhulk reaperhulk deleted the claude/eloquent-shannon-6eD76 branch June 6, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants