diff --git a/src/Geralt.Tests/BLAKE2bTests.cs b/src/Geralt.Tests/BLAKE2bTests.cs index a53b95b..6e6cae2 100644 --- a/src/Geralt.Tests/BLAKE2bTests.cs +++ b/src/Geralt.Tests/BLAKE2bTests.cs @@ -314,7 +314,13 @@ public void Incremental_Valid(string hash, string message, string? key = null) Span k = key != null ? Convert.FromHexString(key) : Span.Empty; using var blake2b = new IncrementalBLAKE2b(h.Length, k); - blake2b.Update(m); + if (m.Length > 1) { + blake2b.Update(m[..(m.Length / 2)]); + blake2b.Update(m[(m.Length / 2)..]); + } + else { + blake2b.Update(m); + } blake2b.Finalize(h); Assert.AreEqual(hash, Convert.ToHexString(h).ToLower()); diff --git a/src/Geralt.Tests/Ed25519Tests.cs b/src/Geralt.Tests/Ed25519Tests.cs index b4a7466..f250170 100644 --- a/src/Geralt.Tests/Ed25519Tests.cs +++ b/src/Geralt.Tests/Ed25519Tests.cs @@ -309,7 +309,13 @@ public void Incremental_Sign_Valid(string signature, string message, string priv Span sk = Convert.FromHexString(privateKey); using var ed25519ph = new IncrementalEd25519(); - ed25519ph.Update(m); + if (m.Length > 1) { + ed25519ph.Update(m[..(m.Length / 2)]); + ed25519ph.Update(m[(m.Length / 2)..]); + } + else { + ed25519ph.Update(m); + } ed25519ph.Finalize(s, sk); Assert.AreEqual(signature, Convert.ToHexString(s).ToLower()); @@ -338,7 +344,13 @@ public void Incremental_Verify_Valid(string signature, string message, string pr Span pk = Convert.FromHexString(privateKey)[^Ed25519.PublicKeySize..]; using var ed25519ph = new IncrementalEd25519(); - ed25519ph.Update(m); + if (m.Length > 1) { + ed25519ph.Update(m[..(m.Length / 2)]); + ed25519ph.Update(m[(m.Length / 2)..]); + } + else { + ed25519ph.Update(m); + } bool valid = ed25519ph.Verify(s, pk); diff --git a/src/Geralt.Tests/Poly1305Tests.cs b/src/Geralt.Tests/Poly1305Tests.cs index bc709bb..536c70c 100644 --- a/src/Geralt.Tests/Poly1305Tests.cs +++ b/src/Geralt.Tests/Poly1305Tests.cs @@ -116,7 +116,13 @@ public void Incremental_Valid(string tag, string message, string oneTimeKey) Span k = Convert.FromHexString(oneTimeKey); using var poly1305 = new IncrementalPoly1305(k); - poly1305.Update(m); + if (m.Length > 1) { + poly1305.Update(m[..(m.Length / 2)]); + poly1305.Update(m[(m.Length / 2)..]); + } + else { + poly1305.Update(m); + } poly1305.Finalize(t); Assert.AreEqual(tag, Convert.ToHexString(t).ToLower());