/// <summary> /// Helper to validate a BLAKE2 hash. /// </summary> /// <param name="data">Data to hash.</param> /// <param name="key">Key to hash.</param> /// <param name="expectedHash">Expected value.</param> private void CheckHash(byte[] data, byte[] key, byte[] expectedHash) { ulong[][] blocks = Blake2b.GetDataBlocks(data, key); byte[] hash = Blake2b.Hash(blocks, data.Length, (byte)key.Length, 64); for (int i = 0; i < 64; i++) { Assert.AreEqual(expectedHash[i], hash[i], $"hash byte #{i}"); } }