From 98972c80f0bcb0bbcad9348d9243856c1eba27fb Mon Sep 17 00:00:00 2001 From: drieseng Date: Sun, 13 Mar 2022 23:07:43 +0100 Subject: [PATCH] Pass data to MemoryStream.ctor(byte[]) instead of writing it to the memory stream (which would have it allocate a new buffer). Fixes issue #1. --- src/SshNetTests/TestBase.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/SshNetTests/TestBase.cs b/src/SshNetTests/TestBase.cs index 022697d..2ab872b 100644 --- a/src/SshNetTests/TestBase.cs +++ b/src/SshNetTests/TestBase.cs @@ -40,11 +40,8 @@ protected static string CreateHash(Stream stream) protected static string CreateHash(byte[] buffer) { - using (var ms = new MemoryStream()) + using (var ms = new MemoryStream(buffer)) { - ms.Write(buffer, 0, buffer.Length); - ms.Position = 0; - return CreateHash(ms); } }