Ejemplo n.º 1
0
        public void TestSha384()
        {
            var sha384 = new Sha384();
            var bytes  = Encoding.UTF8.GetBytes("abc");

            var hash      = sha384.ComputeHash(bytes);
            var sha384str = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();

            Assert.AreEqual(sha384str, "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7");
        }
Ejemplo n.º 2
0
        public void Hash(int count, string value)
        {
            Assert.Equal(count, value.Length);
            var shaClr       = SHA384.Create();
            var sha          = new Sha384();
            var data         = Encoding.UTF8.GetBytes(value);
            var expectedHash = shaClr.ComputeHash(data);

            var result = new byte[48];

            sha.ComputeHash(data, result);
            Assert.Equal(expectedHash, result);
        }
Ejemplo n.º 3
0
        protected override void ComputeHash(ReadOnlySpan <byte> source, Span <byte> destination)
        {
            var sha384 = new Sha384();

            sha384.ComputeHash(source, destination);
        }