All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.crypto.test.MD5DigestTest Maven / Gradle / Ivy

Go to download

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8.

There is a newer version: 1.79
Show newest version
package org.bouncycastle.crypto.test;

import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.digests.MD5Digest;

/**
 * standard vector test for MD5 from "Handbook of Applied Cryptography", page 345.
 */
public class MD5DigestTest
    extends DigestTest
{
    static final String[] messages =
    {
        "",
        "a",
        "abc",
        "abcdefghijklmnopqrstuvwxyz"
    };
    
    static final String[] digests =
    {
        "d41d8cd98f00b204e9800998ecf8427e",
        "0cc175b9c0f1b6a831c399e269772661",
        "900150983cd24fb0d6963f7d28e17f72",
        "c3fcd3d76192e4007dfb496cca67e13b"
    };

    MD5DigestTest()
    {
        super(new MD5Digest(), messages, digests);
    }

    protected Digest cloneDigest(Digest digest)
    {
        return new MD5Digest((MD5Digest)digest);
    }

    protected Digest cloneDigest(byte[] encodedState)
    {
        return new MD5Digest(encodedState);
    }
    
    public static void main(
        String[]    args)
    {
        runTest(new MD5DigestTest());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy