// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA256_DIGEST = "d281d10296b7bde20df3f3f4a6d1bdb513f4aa4ccb0048c7b2f7f5786b4bcb77";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA256_DIGEST_EMPTY_STRING = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA256_MESSAGE = "My Bonnie lies over the ocean, my Bonnie lies over the sea";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA512_DIGEST = "2823e0373001b5f3aa6db57d07bc588324917fc221dd27975613942d7f2e19bf4" +
//         "44654c8b9f4f9cb908ef15f2304522e60e9ced3fdec66e34bc2afb52be6ad1c";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA512_DIGEST_EMPTY_STRING = "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921" +
//         "d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA512_MESSAGE = "My Bonnie lies over the ocean, Oh bring back my Bonnie to me";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_MESSAGE = "The quick brown fox jumps over the lazy dog";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_DIGEST = "01718cec35cd3d796dd00020e0bfecb473ad23457d063b75eff29c0ffa2e58a9";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_DIGEST_EMPTY_STRING = "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_DIGEST_WITH_SALT_PERSONAL = "108e81d0c7b0487de45c54554ea35b427f886b098d792497c6a803bbac7a5f7c";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_KEY = "This is a super secret key. Ssshh!";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_SALT = "0123456789abcdef";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_PERSONAL = "fedcba9876543210";


import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertTrue;
import static org.abstractj.kalium.encoders.Encoder.HEX;
import static org.abstractj.kalium.fixture.TestVectors.SHA256_DIGEST;
import static org.abstractj.kalium.fixture.TestVectors.SHA256_DIGEST_EMPTY_STRING;
import static org.abstractj.kalium.fixture.TestVectors.SHA256_MESSAGE;
import static org.abstractj.kalium.fixture.TestVectors.SHA512_DIGEST;
import static org.abstractj.kalium.fixture.TestVectors.SHA512_DIGEST_EMPTY_STRING;
import static org.abstractj.kalium.fixture.TestVectors.SHA512_MESSAGE;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_MESSAGE;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_DIGEST;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_DIGEST_EMPTY_STRING;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_DIGEST_WITH_SALT_PERSONAL;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_KEY;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_SALT;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_PERSONAL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
    public void testBlake2EmptyString() throws Exception {
        byte[] result = hash.blake2("".getBytes());
        assertEquals("Hash is invalid", Blake2_DIGEST_EMPTY_STRING, HEX.encode(result));
    }

    @Test
    public void testBlake2HexString() throws Exception {
        String result = hash.blake2(Blake2_MESSAGE, HEX);
        assertEquals("Hash is invalid", Blake2_DIGEST, result);
    }

    @Test
    public void testBlake2EmptyHexString() throws Exception {
        String result = hash.blake2("", HEX);
        assertEquals("Hash is invalid", Blake2_DIGEST_EMPTY_STRING, result);
    }

    @Test
    public void testBlake2NullByte() {
        try {
            hash.blake2("\0".getBytes());
        } catch (Exception e) {
            fail("Should not raise any exception on null byte");
        }
    }

    @Test
    public void testBlake2WithSaltAndPersonal() {
        byte[] result = hash.blake2(Blake2_MESSAGE.getBytes(), Blake2_KEY.getBytes(),
                Blake2_SALT.getBytes(),
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA256_DIGEST = "d281d10296b7bde20df3f3f4a6d1bdb513f4aa4ccb0048c7b2f7f5786b4bcb77";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA256_DIGEST_EMPTY_STRING = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA256_MESSAGE = "My Bonnie lies over the ocean, my Bonnie lies over the sea";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA512_DIGEST = "2823e0373001b5f3aa6db57d07bc588324917fc221dd27975613942d7f2e19bf4" +
//         "44654c8b9f4f9cb908ef15f2304522e60e9ced3fdec66e34bc2afb52be6ad1c";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA512_DIGEST_EMPTY_STRING = "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921" +
//         "d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String SHA512_MESSAGE = "My Bonnie lies over the ocean, Oh bring back my Bonnie to me";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_MESSAGE = "The quick brown fox jumps over the lazy dog";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_DIGEST = "01718cec35cd3d796dd00020e0bfecb473ad23457d063b75eff29c0ffa2e58a9";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_DIGEST_EMPTY_STRING = "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_DIGEST_WITH_SALT_PERSONAL = "108e81d0c7b0487de45c54554ea35b427f886b098d792497c6a803bbac7a5f7c";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_KEY = "This is a super secret key. Ssshh!";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_SALT = "0123456789abcdef";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String Blake2_PERSONAL = "fedcba9876543210";


// Path: src/test/java/org/abstractj/kalium/crypto/HashTest.java
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertTrue;
import static org.abstractj.kalium.encoders.Encoder.HEX;
import static org.abstractj.kalium.fixture.TestVectors.SHA256_DIGEST;
import static org.abstractj.kalium.fixture.TestVectors.SHA256_DIGEST_EMPTY_STRING;
import static org.abstractj.kalium.fixture.TestVectors.SHA256_MESSAGE;
import static org.abstractj.kalium.fixture.TestVectors.SHA512_DIGEST;
import static org.abstractj.kalium.fixture.TestVectors.SHA512_DIGEST_EMPTY_STRING;
import static org.abstractj.kalium.fixture.TestVectors.SHA512_MESSAGE;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_MESSAGE;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_DIGEST;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_DIGEST_EMPTY_STRING;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_DIGEST_WITH_SALT_PERSONAL;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_KEY;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_SALT;
import static org.abstractj.kalium.fixture.TestVectors.Blake2_PERSONAL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

    public void testBlake2EmptyString() throws Exception {
        byte[] result = hash.blake2("".getBytes());
        assertEquals("Hash is invalid", Blake2_DIGEST_EMPTY_STRING, HEX.encode(result));
    }

    @Test
    public void testBlake2HexString() throws Exception {
        String result = hash.blake2(Blake2_MESSAGE, HEX);
        assertEquals("Hash is invalid", Blake2_DIGEST, result);
    }

    @Test
    public void testBlake2EmptyHexString() throws Exception {
        String result = hash.blake2("", HEX);
        assertEquals("Hash is invalid", Blake2_DIGEST_EMPTY_STRING, result);
    }

    @Test
    public void testBlake2NullByte() {
        try {
            hash.blake2("\0".getBytes());
        } catch (Exception e) {
            fail("Should not raise any exception on null byte");
        }
    }

    @Test
    public void testBlake2WithSaltAndPersonal() {
        byte[] result = hash.blake2(Blake2_MESSAGE.getBytes(), Blake2_KEY.getBytes(),
                Blake2_SALT.getBytes(),
                Blake2_PERSONAL.getBytes());