forked from Qortal/qortal
eaad565765
This allows them to be excluded from final built package. pom.xml and .classpath updated Unable to test due to lack of JUnit 5 in Eclipse Neon
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package test;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
import com.google.common.hash.HashCode;
|
|
|
|
import qora.crypto.Crypto;
|
|
|
|
public class CryptoTests {
|
|
|
|
@Test
|
|
public void testCryptoDigest() {
|
|
byte[] input = HashCode.fromString("00").asBytes();
|
|
byte[] digest = Crypto.digest(input);
|
|
byte[] expected = HashCode.fromString("6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d").asBytes();
|
|
|
|
assertArrayEquals(expected, digest);
|
|
}
|
|
|
|
@Test
|
|
public void testCryptoDoubleDigest() {
|
|
byte[] input = HashCode.fromString("00").asBytes();
|
|
byte[] digest = Crypto.doubleDigest(input);
|
|
byte[] expected = HashCode.fromString("1406e05881e299367766d313e26c05564ec91bf721d31726bd6e46e60689539a").asBytes();
|
|
|
|
assertArrayEquals(expected, digest);
|
|
}
|
|
|
|
@Test
|
|
public void testCryptoQoraAddress() {
|
|
byte[] publicKey = HashCode.fromString("775ada64a48a30b3bfc4f1db16bca512d4088704975a62bde78781ce0cba90d6").asBytes();
|
|
String expected = "QUD9y7NZqTtNwvSAUfewd7zKUGoVivVnTW";
|
|
|
|
assertEquals(expected, Crypto.toAddress(publicKey));
|
|
}
|
|
|
|
}
|