Here you can find the source of hmacSha1(byte[] key_bytes, byte[] text_bytes)
public static byte[] hmacSha1(byte[] key_bytes, byte[] text_bytes) throws NoSuchAlgorithmException, InvalidKeyException
//package com.java2s; //License from project: MIT License import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; public class Main { public static byte[] hmacSha1(byte[] key_bytes, byte[] text_bytes) throws NoSuchAlgorithmException, InvalidKeyException { Mac hmacSha1;// w w w. j a v a 2 s . com try { hmacSha1 = Mac.getInstance("HmacSHA1"); } catch (NoSuchAlgorithmException nsae) { hmacSha1 = Mac.getInstance("HMAC-SHA-1"); } SecretKeySpec macKey = new SecretKeySpec(key_bytes, "RAW"); hmacSha1.init(macKey); return hmacSha1.doFinal(text_bytes); } }