Here you can find the source of hmacSha512(byte[] key, byte[] message)
public static byte[] hmacSha512(byte[] key, byte[] message) throws NoSuchAlgorithmException, InvalidKeyException
//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*/ }