Java examples for Security:SHA
This function calculates the SHA1 value of a given string
//package com.java2s; import java.security.MessageDigest; public class Main { /**//from ww w .j a va 2 s . c o m * This function calculates the SHA1 value of a given string * * @param content * @return */ public static byte[] generateSHA(String content) { byte[] result = null; try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(content.getBytes()); result = md.digest(); md.reset(); } catch (Exception e) { // Logger.error("generateSHA: " + e.getMessage()); } return result; } }