Here you can find the source of hmacSha1(SecretKey key, byte[] data)
public static byte[] hmacSha1(SecretKey key, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException
//package com.java2s; //License from project: Open Source License import java.security.*; import javax.crypto.*; public class Main { public static final String HmacSHA1 = "HmacSHA1"; public static byte[] hmacSha1(SecretKey key, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException { Mac m = Mac.getInstance(HmacSHA1); m.init(key);/* w ww . java 2s .c om*/ m.update(data); byte[] mac = m.doFinal(); return mac; } }