Java 类fr.cryptohash.RIPEMD160 实例源码

项目:burstcoin    文件:AT_API_Impl.java   
@Override
public void HASH160_A_to_B( AT_Machine_State state ) {
    ByteBuffer b = ByteBuffer.allocate(32);
    b.order(ByteOrder.LITTLE_ENDIAN);

    b.put(state.get_A1());
    b.put(state.get_A2());
    b.put(state.get_A3());
    b.put(state.get_A4());

    RIPEMD160 ripemd160 = new RIPEMD160();
    ByteBuffer ripemdb = ByteBuffer.wrap(ripemd160.digest(b.array()));
    ripemdb.order(ByteOrder.LITTLE_ENDIAN);

    state.set_B1(AT_API_Helper.getByteArray(ripemdb.getLong(0)));
    state.set_B2(AT_API_Helper.getByteArray(ripemdb.getLong(8)));
    state.set_B3(AT_API_Helper.getByteArray((long)ripemdb.getInt(16)));

}
项目:burstcoin    文件:AT_API_Impl.java   
@Override
public long check_HASH160_A_with_B( AT_Machine_State state ) {
    if ( state.getHeight() >= Constants.AT_FIX_BLOCK_3 ) {
        ByteBuffer b = ByteBuffer.allocate( 32 );
        b.order( ByteOrder.LITTLE_ENDIAN );

        b.put( state.get_A1() );
        b.put( state.get_A2() );
        b.put( state.get_A3() );
        b.put( state.get_A4() );

        RIPEMD160 ripemd160 = new RIPEMD160();
        ByteBuffer ripemdb = ByteBuffer.wrap( ripemd160.digest( b.array() ) );
        ripemdb.order( ByteOrder.LITTLE_ENDIAN );

        return ( ripemdb.getLong(0) == AT_API_Helper.getLong( state.get_B1() ) &&
                 ripemdb.getLong(8) == AT_API_Helper.getLong( state.get_B2() ) &&
                 ripemdb.getInt(16) == ((int)(AT_API_Helper.getLong( state.get_B3() ) & 0x00000000FFFFFFFFL ))
                 ) ? 1 : 0;
    }
    else {
        return(Arrays.equals(state.get_A1(), state.get_B1()) &&
                Arrays.equals(state.get_A2(), state.get_B2()) &&
                (AT_API_Helper.getLong(state.get_A3()) & 0x00000000FFFFFFFFL) == (AT_API_Helper.getLong(state.get_B3()) & 0x00000000FFFFFFFFL)) ? 1 : 0;
    }
}
项目:burstcoin    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:risecoin    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:digibytej-alice    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:cannabiscoinj    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:quarkcoinj    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:animecoinj    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:myriadcoinj    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:dashj    文件:TestDigest.java   
/**
 * Test RIPEMD-160 implementation.
 */
private static void testRIPEMD160()
{
    Digest dig = new RIPEMD160();
    testKat(dig, "",
        "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
        "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
        "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
        "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
        "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
        + "lmnomnopnopq",
        "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
        + "stuvwxyz0123456789",
        "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
        + "567890123456789012345678901234567890",
        "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
        "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:sphlib    文件:RIPEMD160Test.java   
@Test
public void testRIPEMD160() {
    Digest dig = new RIPEMD160();
    testKat(dig, "",
            "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
            "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
            "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
            "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
            "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
            + "lmnomnopnopq",
            "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
            + "stuvwxyz0123456789",
            "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
            + "567890123456789012345678901234567890",
            "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
            "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}
项目:sphlib    文件:RIPEMDTest.java   
@Test
public void testRIPEMD160() {
    Digest dig = new RIPEMD160();
    testKat(dig, "",
            "9c1185a5c5e9fc54612808977ee8f548b2258d31");
    testKat(dig, "a",
            "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
    testKat(dig, "abc",
            "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
    testKat(dig, "message digest",
            "5d0689ef49d2fae572b881b123a85ffa21595f36");
    testKat(dig, "abcdefghijklmnopqrstuvwxyz",
            "f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
    testKat(dig, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
            + "lmnomnopnopq",
            "12a053384a9c0c88e405a06c27dcf49ada62eb2b");
    testKat(dig, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
            + "stuvwxyz0123456789",
            "b0e20b6e3116640286ed3a87a5713079b21f5189");
    testKat(dig, "12345678901234567890123456789012345678901234"
            + "567890123456789012345678901234567890",
            "9b752e45573d4b39f4dbd3323cab82bf63326bfb");

    testKatMillionA(dig,
            "52783243c1697bdbe16d37f97f68f08325dc1528");

    reportSuccess("RIPEMD-160");
}