Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Get MD5 Hash In A Few Lines Of Java

DZone's Guide to

Get MD5 Hash In A Few Lines Of Java

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.


    1 import java.security.*;
    2 import java.math.*;
    3 
    4 public class MD5 {
    5    public static void main(String args[]) throws Exception{
    6       String s="This is a test";
    7       MessageDigest m=MessageDigest.getInstance("MD5");
    8       m.update(s.getBytes(),0,s.length());
    9       System.out.println("MD5: "+new BigInteger(1,m.digest()).toString(16));
   10    }
   11 }


Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:
md5 ,java

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}