public static int HashData(string hashAlgorithmId, ReadOnlySpan <byte> source, Span <byte> destination)
            {
                HashProvider provider = CreateHashProvider(hashAlgorithmId);

                provider.AppendHashData(source);
                return(provider.FinalizeHashAndReset(destination));
            }
 public static unsafe int MacData(
     string hashAlgorithmId,
     ReadOnlySpan <byte> key,
     ReadOnlySpan <byte> source,
     Span <byte> destination)
 {
     using HashProvider provider = CreateMacProvider(hashAlgorithmId, key);
     provider.AppendHashData(source);
     return(provider.FinalizeHashAndReset(destination));
 }
示例#3
0
 public static int HashData(string hashAlgorithmId, ReadOnlySpan <byte> source, Span <byte> destination)
 {
     if (Interop.BrowserCrypto.CanUseSubtleCrypto)
     {
         return(SHANativeHashProvider.HashOneShot(hashAlgorithmId, source, destination));
     }
     else
     {
         HashProvider provider = CreateHashProvider(hashAlgorithmId);
         provider.AppendHashData(source);
         return(provider.FinalizeHashAndReset(destination));
     }
 }
示例#4
0
 public static unsafe int MacData(
     string hashAlgorithmId,
     ReadOnlySpan <byte> key,
     ReadOnlySpan <byte> source,
     Span <byte> destination)
 {
     if (Interop.BrowserCrypto.CanUseSubtleCrypto)
     {
         return(HMACNativeHashProvider.MacDataOneShot(hashAlgorithmId, key, source, destination));
     }
     else
     {
         using HashProvider provider = CreateMacProvider(hashAlgorithmId, key);
         provider.AppendHashData(source);
         return(provider.FinalizeHashAndReset(destination));
     }
 }