Here you can find the source of sha1Utf8(String clearText)
public static String sha1Utf8(String clearText)
//package com.java2s; //License from project: Open Source License import java.nio.charset.Charset; import java.security.MessageDigest; public class Main { public static String sha1Utf8(String clearText) { StringBuilder sb = new StringBuilder(); try {//from w ww . j a v a2 s.c o m MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(clearText.getBytes(Charset.forName("UTF-8"))); byte[] md5 = md.digest(); for (byte b : md5) { int i = (b & 0xff); if (i < 16) sb.append("0"); sb.append(Integer.toHexString(i).toUpperCase()); } } catch (Exception e) { return "Can't sha1, exception " + e.getMessage(); } return sb.toString(); } }