Here you can find the source of SHA1(String text)
public static byte[] SHA1(String text)
//package com.java2s; /*/* w w w . jav a 2s .c om*/ * This file is part of Vapor. * * Copyright (c) 2013-2013, Snaipe <http://snaipe.me/> * Vapor is licensed under the GNU Lesser General Public License Version 3. * * Vapor is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * * Vapor is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> * for the GNU Lesser General Public License. */ import java.security.MessageDigest; public class Main { public static byte[] SHA1(String text) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(text.getBytes("US-ASCII"), 0, text.length()); return md.digest(); } catch (Throwable t) { throw new RuntimeException(t); // not happening ever, but you never know... } } }