Java MD5 digestMd5(final String value)

Here you can find the source of digestMd5(final String value)

Description

Creates an MD5 hash of a String.

License

Open Source License

Parameter

Parameter Description
value String to create one way hash upon.

Return

MD5 hash.

Declaration

public static byte[] digestMd5(final String value) 

Method Source Code

//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());
    }
}

Related

  1. byteArrayMD5(byte[] entity)
  2. core_md5(int[] K, int F)
  3. decodeMd5(String source)
  4. decryMd5(String source)
  5. digestMD5(byte[] data)
  6. digestMD5(String buffer, String key)
  7. digestMD5(String data)
  8. digestMD5(String login, String pass)
  9. digestMd5(String plain)