Search in sources :

Example 1 with HashAlgorithm

use of it.unica.tcs.lib.Hash.HashAlgorithm in project balzac by balzac-lang.

the class BitcoinUtilsTest method test_hash_refl.

@Test
public void test_hash_refl() {
    HashAlgorithm[] hashClasses = new HashAlgorithm[] { HashAlgorithm.HASH160, HashAlgorithm.HASH256, HashAlgorithm.RIPEMD160, HashAlgorithm.SHA256, HashAlgorithm.SHA1 };
    Object[] values = new Object[] { 1, 1L, "", true, new byte[42], new Hash(new byte[20]), new Hash(new byte[20]), new Hash(new byte[32]), new Hash(new byte[32]) };
    for (HashAlgorithm hashCls : hashClasses) {
        for (Object v : values) {
            assertArrayEquals(executeScript(v, hashCls), BitcoinUtils.hash(v, hashCls).getBytes());
        }
    }
}
Also used : Hash(it.unica.tcs.lib.Hash) HashAlgorithm(it.unica.tcs.lib.Hash.HashAlgorithm) Test(org.junit.Test)

Aggregations

Hash (it.unica.tcs.lib.Hash)1 HashAlgorithm (it.unica.tcs.lib.Hash.HashAlgorithm)1 Test (org.junit.Test)1