Here you can find the source of digestMd5(final String value)
Parameter | Description |
---|---|
value | String to create one way hash upon. |
public static byte[] digestMd5(final String value)
//package com.java2s; /*/*w w w .j a va2s.c o m*/ // This software is subject to the terms of the Eclipse Public License v1.0 // Agreement, available at the following URL: // http://www.eclipse.org/legal/epl-v10.html. // You must accept the terms of that agreement to use this software. // // Copyright (C) 2001-2005 Julian Hyde // Copyright (C) 2005-2012 Pentaho and others // All Rights Reserved. */ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /** * Creates an MD5 hash of a String. * * @param value String to create one way hash upon. * @return MD5 hash. */ public static byte[] digestMd5(final String value) { final MessageDigest algorithm; try { algorithm = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } return algorithm.digest(value.getBytes()); } }