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)); }
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)); } }
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)); } }