示例#1
0
        internal static byte[] HashStream(string hashAlgorithmId, int hashSizeInBytes, Stream source)
        {
            byte[]   result  = new byte[hashSizeInBytes];
            LiteHash hash    = CreateHash(hashAlgorithmId);
            int      written = ProcessStream(hash, source, result);

            Debug.Assert(written == hashSizeInBytes);
            return(result);
        }
示例#2
0
        internal static ValueTask <byte[]> HashStreamAsync(
            string hashAlgorithmId,
            int hashSizeInBytes,
            Stream source,
            CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return(ValueTask.FromCanceled <byte[]>(cancellationToken));
            }

            LiteHash hash = CreateHash(hashAlgorithmId);

            return(ProcessStreamAsync(hash, source, cancellationToken));
        }
示例#3
0
 public EvpHashProvider(string hashAlgorithmId)
 {
     _liteHash = LiteHashProvider.CreateHash(hashAlgorithmId);
 }
示例#4
0
        internal static int HashStream(string hashAlgorithmId, int hashSizeInBytes, Stream source, Span <byte> destination)
        {
            LiteHash hash = CreateHash(hashAlgorithmId);

            return(ProcessStream(hash, source, destination));
        }
 public AppleDigestProvider(string hashAlgorithmId)
 {
     _liteHash = LiteHashProvider.CreateHash(hashAlgorithmId);
 }