예제 #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));
        }
예제 #5
0
 public AppleDigestProvider(string hashAlgorithmId)
 {
     _liteHash = LiteHashProvider.CreateHash(hashAlgorithmId);
 }