Java MD5 digestMD5(String buffer, String key)

Here you can find the source of digestMD5(String buffer, String key)

Description

Digests the buffer with key using MD5 algorithm.

License

Open Source License

Parameter

Parameter Description
buffer buffer.
key key is secret key (password or something else which isn't going to be passed over network).

Exception

Parameter Description

Return

digested buffer.

Declaration

public static byte[] digestMD5(String buffer, String key) throws NoSuchAlgorithmException 

Method Source Code

//package com.java2s;
// the terms of the GNU General Public License as published by the Free Software Foundation;

import java.security.NoSuchAlgorithmException;
import java.security.MessageDigest;

public class Main {
    /**/*w  w  w.j  a  va2 s  .c o  m*/
     * Digests the buffer with key using MD5 algorithm.
     *
     * @param buffer    buffer.
     * @param key       key is secret key (password or something else which isn't
     *                  going to be passed over network).
     *
     * @return digested buffer.
     *
     * @throws java.security.NoSuchAlgorithmException if there's no MD5 algorithm implemetation.
     */
    public static byte[] digestMD5(String buffer, String key) throws NoSuchAlgorithmException {
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        md5.update(buffer.getBytes());
        return md5.digest(key.getBytes());
    }
}

Related

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