mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
4bf7060ec7
ReSharper 2020.Something modified the var style again so that arrays of built-in types also count as built-in types, meaning the type should always be explicit.
31 lines
870 B
C#
31 lines
870 B
C#
using System;
|
|
using LibHac.Crypto;
|
|
using Xunit;
|
|
|
|
namespace LibHac.Tests.CryptoTests
|
|
{
|
|
internal static class Common
|
|
{
|
|
internal static void CipherTestCore(byte[] inputData, byte[] expected, ICipher cipher)
|
|
{
|
|
byte[] transformBuffer = new byte[inputData.Length];
|
|
Buffer.BlockCopy(inputData, 0, transformBuffer, 0, inputData.Length);
|
|
|
|
cipher.Transform(transformBuffer, transformBuffer);
|
|
|
|
Assert.Equal(expected, transformBuffer);
|
|
}
|
|
|
|
internal static void HashTestCore(ReadOnlySpan<byte> message, byte[] expectedDigest, IHash hash)
|
|
{
|
|
|
|
byte[] digestBuffer = new byte[Sha256.DigestSize];
|
|
|
|
hash.Initialize();
|
|
hash.Update(message);
|
|
hash.GetHash(digestBuffer);
|
|
|
|
Assert.Equal(expectedDigest, digestBuffer);
|
|
}
|
|
}
|
|
}
|