June 02, 2017
import java.security.MessageDigest;
public static void main(String[] args) { Scanner ab=new Scanner(System.in); String str=ab.next(); try {
// create a instance of class with md5 algo
MessageDigest md=MessageDigest.getInstance("MD5");
md.update(str.getBytes());
// will give hash code to array
byte[] digest = md.digest();
for (byte b : digest) { System.out.printf("%02x", b); } } catch (Exception ex) { throw new RuntimeException(ex); } }
0 Comments:
Post a Comment