public static void HashWithWrongKey() { var a = new Blake2bMac(); using (var k = new Key(new Ed25519())) { Assert.Throws <ArgumentException>("key", () => a.Mac(k, ReadOnlySpan <byte> .Empty)); } }
public static void HashWithMaxSpanSuccess() { var a = new Blake2bMac(); using (var k = new Key(a)) { a.Mac(k, ReadOnlySpan <byte> .Empty, new byte[a.MaxMacSize]); } }
public static void HashWithSpanTooLarge() { var a = new Blake2bMac(); using (var k = new Key(a)) { Assert.Throws <ArgumentException>("mac", () => a.Mac(k, ReadOnlySpan <byte> .Empty, new byte[a.MaxMacSize + 1])); } }
public static void HashWithSizeTooSmall() { var a = new Blake2bMac(); using (var k = new Key(a)) { Assert.Throws <ArgumentOutOfRangeException>("macSize", () => a.Mac(k, ReadOnlySpan <byte> .Empty, a.MinMacSize - 1)); } }
public static void HashWithKeySuccess() { var a = new Blake2bMac(); using (var k = new Key(a)) { var b = a.Mac(k, ReadOnlySpan <byte> .Empty); Assert.NotNull(b); Assert.Equal(a.DefaultMacSize, b.Length); } }
public static void HashWithNullKey() { var a = new Blake2bMac(); Assert.Throws <ArgumentNullException>("key", () => a.Mac(null, ReadOnlySpan <byte> .Empty)); }