MD5 Implementation in Java

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
package tester;
import java.math.*;

 * @author agung
public class Tester {

     * @param args the command line arguments
    public static void main(String[] args) {
        // TODO code application logic here

        String s="admin";
            MessageDigest m=MessageDigest.getInstance("MD5");

            String encripted;
            //Wajib Di tampung dulu biar hasil encripsi gak berubah
            encripted = new BigInteger(1,m.digest()).toString(16);

            System.out.println("MD5: "+encripted);
            //Kalau gak di tampung dahulu nanti hasil encripsi nya seperti ini
            System.out.println("MD5: "+new BigInteger(1,m.digest()).toString(16));

            String code = "21232f297a57a5a743894a0e4a801fc3";

                System.out.println("Sama" );

                System.out.println("Beda" + new BigInteger(1,m.digest()).toString(16).equals("21232f297a57a5a743894a0e4a801fc3"));

        catch(Exception exception){


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: