Here you can find the source of SHAsum(byte[] convertme)
public static String SHAsum(byte[] convertme)
//package com.java2s; /*/* ww w.j a va 2 s . c o m*/ * Copyright 2014 scape. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Formatter; public class Main { public static String SHAsum(byte[] convertme) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); return "sha1:" + byteArray2Hex(md.digest(convertme)); } catch (NoSuchAlgorithmException e) { return ""; } } private static String byteArray2Hex(final byte[] hash) { Formatter formatter = new Formatter(); for (byte b : hash) { formatter.format("%02x", b); } return formatter.toString(); } }