Java HMAC hmacSha512(byte[] key, byte[] message)

Here you can find the source of hmacSha512(byte[] key, byte[] message)

Description

hmac Sha

License

Open Source License

Declaration

public static byte[] hmacSha512(byte[] key, byte[] message)
            throws NoSuchAlgorithmException, InvalidKeyException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.security.InvalidKeyException;

import java.security.NoSuchAlgorithmException;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

public class Main {
    private static final String HMAC_SHA512 = "HmacSHA512";

    public static byte[] hmacSha512(byte[] key, byte[] message)
            throws NoSuchAlgorithmException, InvalidKeyException {
        Mac mac = Mac.getInstance(HMAC_SHA512);
        mac.init(new SecretKeySpec(key, HMAC_SHA512));
        return mac.doFinal(message);
    }/*from  w  w w  .  j  a  v  a 2  s  .com*/
}

Related

  1. hmacSha1(String input, byte[] keyBytes)
  2. hmacSha1(String input, byte[] keyBytes)
  3. hmacSHA256(byte[] secret, byte[] data)
  4. hmacSha256(String keyHex, String stringData)
  5. hmacsha256Representation(String data, String pusherApplicationSecret)
  6. hmacSign(String aValue, String aKey)
  7. hmacSign(String skey, String data)