mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 23:57:25 +01:00
is activated in the workspace settings. This required the addition of a new lib (in source form) for a SipHash implementation.
28 lines
821 B
Java
28 lines
821 B
Java
package com.zackehh.siphash;
|
|
|
|
import org.testng.Assert;
|
|
import org.testng.annotations.Test;
|
|
|
|
public class SipHashKeyTest {
|
|
|
|
@Test
|
|
public void initializeWithKey() throws Exception {
|
|
SipHashKey key = new SipHashKey("0123456789ABCDEF".getBytes());
|
|
|
|
long k0 = SipHashTestUtils.getPrivateField(key, "k0", Long.class);
|
|
long k1 = SipHashTestUtils.getPrivateField(key, "k1", Long.class);
|
|
|
|
Assert.assertEquals(k0, 3978425819141910832L);
|
|
Assert.assertEquals(k1, 5063528411713059128L);
|
|
}
|
|
|
|
@Test(
|
|
expectedExceptions = IllegalArgumentException.class,
|
|
expectedExceptionsMessageRegExp = "Key must be exactly 16 bytes!"
|
|
)
|
|
public void initializeWithKeyTooLong() throws Exception {
|
|
new SipHashKey("0123456789ABCDEFG".getBytes()); // 17 bytes
|
|
}
|
|
|
|
}
|