Skip to content

Add a plaintext receive buffer#1752

Merged
Rob-Hague merged 1 commit intosshnet:developfrom
Rob-Hague:plaintextbuffer
Feb 10, 2026
Merged

Add a plaintext receive buffer#1752
Rob-Hague merged 1 commit intosshnet:developfrom
Rob-Hague:plaintextbuffer

Conversation

@Rob-Hague
Copy link
Copy Markdown
Collaborator

Continuing from previous changes, add a persistent buffer into which the message payload is decrypted, rather than allocating a new array each time.

With this change and #1733, #1738 (plus #1650 in 2025.1.0), allocations for the server-to-client (e.g. download) direction are significantly reduced compared to previous versions.

Download
(SFTP)
Version Allocated
1MB 2025.0.0 4.92MB
1MB 2025.1.0 3.16MB
1MB PR 0.16MB
8MB 2025.0.0 140.4MB
8MB 2025.1.0 24.8MB
8MB PR 0.8MB

Footnotes

  1. Bi-modal between 4x and 5x of file size before Use an array buffer for the sftp packet stream #1649 in 2025.1.0

Continuing from previous changes, add a persistent buffer into which the message
payload is decrypted, rather than allocating a new array each time.
Copy link
Copy Markdown
Member

@drieseng drieseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@Rob-Hague Rob-Hague merged commit 085dead into sshnet:develop Feb 10, 2026
6 checks passed
@Rob-Hague Rob-Hague deleted the plaintextbuffer branch February 10, 2026 18:47
@Rob-Hague
Copy link
Copy Markdown
Collaborator Author

Thanks

Rob-Hague added a commit to Rob-Hague/SSH.NET that referenced this pull request Apr 27, 2026
sshnet#1752 added a persistent buffer into which to decrypt packets, rather than allocating
a new array for each packet. This was on the back of sshnet#1733 which added support in the
cipher types for decrypting into a given buffer, but for the case of AES-CTR, not into
the same buffer in-place. sshnet#1787 adds that missing support, meaning we can now decrypt
in-place, and the plaintext buffer becomes unnecessary.
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.

2 participants