public static unsafe void HashData(this IHashInstance hash, byte[] data) { fixed(byte *prt = data) { hash.HashData(prt, data.Length); } }
public static void HashData(this IHashInstance hash, ReadableBuffer dataToHash) { foreach (var m in dataToHash) { hash.HashData(m); } }
public static unsafe void HashData(this IHashInstance hash, Memory <byte> dataToHash) { GCHandle handle; var ptr = dataToHash.GetPointer(out handle); try { hash.HashData((byte *)ptr, dataToHash.Length); } finally { if (handle.IsAllocated) { handle.Free(); } } }