Here you can find the source of sha1AsBytes(String input)
public static byte[] sha1AsBytes(String input)
//package com.java2s; //License from project: Apache License import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] sha1AsBytes(String input) { return sha1AsBytes(input.getBytes(StandardCharsets.UTF_8)); }/*from w w w .ja va 2 s .com*/ /** * Generate SHA-1 as bytes. * * @param input Input as bytes. * @return Bytes. */ public static byte[] sha1AsBytes(byte[] input) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } md.update(input); return md.digest(); } }