コード例 #1
0
        public void ShouldTranslateNameToAsciiEncodedNullTerminatedOID(HashAlgorithmName name, string oid)
        {
            Span <byte> expectedBytes = stackalloc byte[oid.Length + 1];

            expectedBytes.Fill(0);
            Encoding.ASCII.GetBytes(oid, expectedBytes);
            var actualBytes = AlgorithmTranslator.HashAlgorithmToOidAsciiTerminated(name);

            Assert.True(expectedBytes.SequenceEqual(actualBytes), "ExpectedBytes do not equal actual bytes.");
        }
コード例 #2
0
 public void ShouldTranslateNameToCAPIAlgId(HashAlgorithmName name, uint algId)
 {
     Assert.Equal(algId, AlgorithmTranslator.HashAlgorithmToAlgId(name));
 }