public void SHA512HashTest() { var data = new byte[123456]; new Random().NextBytes(data); var hash1 = SHA512.GetHash(data); var hash2 = System.Security.Cryptography.SHA512.Create().ComputeHash(data); hash1.Should().BeEquivalentTo(hash2, options => options.WithStrictOrdering()); }
public void RSAFunctionalTest() { var data = new byte[123456]; new Random().NextBytes(data); var hash = SHA512.GetHash(data); var(publicKey, privateKey) = RSAKeyGenerator.Generate(); var sign = RSA.Crypt(hash, privateKey); var decryptedHash = RSA.Crypt(sign, publicKey); hash.Should().BeEquivalentTo(decryptedHash, options => options.WithStrictOrdering()); }