Here you can find the source of hmacSha1(byte[] secret, byte[] data)
private static byte[] hmacSha1(byte[] secret, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException
//package com.java2s; //License from project: Apache License import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import javax.crypto.Mac; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class Main { private static byte[] hmacSha1(byte[] secret, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException { String algo = "HmacSHA1"; SecretKey secretKey = new SecretKeySpec(secret, algo); Mac m = Mac.getInstance(algo); m.init(secretKey);/*from www . jav a 2 s . c o m*/ return m.doFinal(data); } }