From 4f62c65f2dccb94405afdedbd4d3746c020f33da Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 3 Jan 2020 21:47:11 +0100 Subject: [PATCH] Bugfix: Stream's position was not reset --- Ed25519/Extensions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Ed25519/Extensions.cs b/Ed25519/Extensions.cs index 4f47195..e0ed216 100644 --- a/Ed25519/Extensions.cs +++ b/Ed25519/Extensions.cs @@ -17,6 +17,8 @@ namespace Ed25519 internal static ReadOnlySpan ComputeHash(this Stream inputStream) { + inputStream.Seek(0, SeekOrigin.Begin); + using var sha512 = SHA512.Create(); return sha512.ComputeHash(inputStream); } @@ -84,6 +86,8 @@ namespace Ed25519 internal static BigInteger HashInt(this MemoryStream data) { + data.Seek(0, SeekOrigin.Begin); + var hash = data.ComputeHash(); var hashSum = BigInteger.Zero;