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