예제 #1
0
        private static Sha1 HashImpl(crypt.SHA1 alg, ReadOnlySpan <byte> span)
        {
            Debug.Assert(alg != null);

            // Do NOT short-circuit here; rely on call-sites to do so
#if !NETSTANDARD2_0
            Span <byte> hash = stackalloc byte[Sha1.ByteLength];
            alg.TryComputeHash(span, hash, out _);
#else
            var hash = alg.ComputeHash(span.ToArray());
#endif
            var sha = new Sha1(hash);
            return(sha);
        }