Ejemplo n.º 1
0
 public static unsafe void HashData(this IHashInstance hash, byte[] data)
 {
     fixed(byte *prt = data)
     {
         hash.HashData(prt, data.Length);
     }
 }
Ejemplo n.º 2
0
 public static void HashData(this IHashInstance hash, ReadableBuffer dataToHash)
 {
     foreach (var m in dataToHash)
     {
         hash.HashData(m);
     }
 }
Ejemplo n.º 3
0
        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();
                }
            }
        }