// Path: ohc-core/src/main/java/org/caffinitas/ohc/HashAlgorithm.java
// public enum HashAlgorithm
// {
//     MURMUR3,
// 
//     CRC32,
// 
//     CRC32C,
// 
//     XX
// }
// 
// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferPosition(ByteBuffer byteBuffer, int position) {
//     byteBufferAccess.position(byteBuffer, position);
// }


import java.nio.ByteBuffer;
import java.util.Random;
import org.caffinitas.ohc.HashAlgorithm;
import org.testng.Assert;
import org.testng.annotations.Test;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferPosition;
    }

    @Test
    public void testCRC32C()
    {
        test(HashAlgorithm.CRC32C);
    }

    @Test
    public void testXX()
    {
        test(HashAlgorithm.XX);
    }

    private void test(HashAlgorithm hash)
    {
        Random rand = new Random();

        byte[] buf = new byte[3211];
        rand.nextBytes(buf);

        Hasher hasher = Hasher.create(hash);
        long arrayVal = hasher.hash(ByteBuffer.wrap(buf));
        ByteBuffer nativeMem = Uns.allocate(buf.length + 99, true);
        try
        {
            for (int i = 0; i < 99; i++)
                nativeMem.put((byte) 0);
            nativeMem.put(buf);

// Path: ohc-core/src/main/java/org/caffinitas/ohc/HashAlgorithm.java
// public enum HashAlgorithm
// {
//     MURMUR3,
// 
//     CRC32,
// 
//     CRC32C,
// 
//     XX
// }
// 
// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferPosition(ByteBuffer byteBuffer, int position) {
//     byteBufferAccess.position(byteBuffer, position);
// }


// Path: ohc-core/src/test/java/org/caffinitas/ohc/chunked/HasherTest.java
import java.nio.ByteBuffer;
import java.util.Random;
import org.caffinitas.ohc.HashAlgorithm;
import org.testng.Assert;
import org.testng.annotations.Test;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferPosition;

    }

    @Test
    public void testCRC32C()
    {
        test(HashAlgorithm.CRC32C);
    }

    @Test
    public void testXX()
    {
        test(HashAlgorithm.XX);
    }

    private void test(HashAlgorithm hash)
    {
        Random rand = new Random();

        byte[] buf = new byte[3211];
        rand.nextBytes(buf);

        Hasher hasher = Hasher.create(hash);
        long arrayVal = hasher.hash(ByteBuffer.wrap(buf));
        ByteBuffer nativeMem = Uns.allocate(buf.length + 99, true);
        try
        {
            for (int i = 0; i < 99; i++)
                nativeMem.put((byte) 0);
            nativeMem.put(buf);

            byteBufferPosition(nativeMem, 99);