private static void Test(IStreamCrypto crypto, int originSize, string hex, string hex2) { Assert.AreEqual(@"RC4", crypto.Name); Span <byte> h1 = hex.FromHex(); Span <byte> h2 = hex2.FromHex(); Span <byte> i = new byte[originSize]; Span <byte> o = stackalloc byte[i.Length]; crypto.Update(i, o); Assert.IsTrue(o.SequenceEqual(h1)); crypto.Update(i, o); Assert.IsTrue(o.SequenceEqual(h2)); crypto.Reset(); crypto.Update(h1, o); Assert.IsTrue(o.SequenceEqual(i)); crypto.Update(h2, o); Assert.IsTrue(o.SequenceEqual(i)); crypto.Dispose(); }
private static void Test(IStreamCrypto crypto, string hex, string hex2) { Assert.AreEqual(@"AES-CFB", crypto.Name); Span <byte> h1 = hex.FromHex(); Span <byte> h2 = hex2.FromHex(); Span <byte> o = stackalloc byte[h1.Length]; crypto.Update(h1, o); Assert.IsTrue(o.SequenceEqual(h2)); crypto.Reset(); crypto.Update(h1[..73], o);