Here you can find the source of digest(String algorithm, byte[] data)
Parameter | Description |
---|---|
algorithm | a parameter |
data | a parameter |
public static byte[] digest(String algorithm, byte[] data)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /**/*from w w w . ja va 2 s. c o m*/ * Hash a given string * @param algorithm * @param data * @return */ public static byte[] digest(String algorithm, byte[] data) { MessageDigest digest; try { digest = MessageDigest.getInstance(algorithm); byte[] hash = digest.digest(data); return hash; } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } }