Java HMAC hmacSha1(SecretKey key, byte[] data)

Here you can find the source of hmacSha1(SecretKey key, byte[] data)

Description

hmac Sha

License

Open Source License

Declaration

public static byte[] hmacSha1(SecretKey key, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException 

Method Source Code

//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;
    }
}

Related

  1. hmacSha(byte[] keyBytes, byte[] text)
  2. hmacSha(String crypto, String key, String value)
  3. hmacSha1(byte[] data, byte[] key)
  4. hmacSha1(byte[] key_bytes, byte[] text_bytes)
  5. hmacSha1(byte[] secret, byte[] data)
  6. hmacSha1(SecretKeySpec signingKey, byte[]... data)
  7. hmacSha1(String data, String key)
  8. hmacSha1(String input, byte[] keyBytes)
  9. hmacSha1(String input, byte[] keyBytes)