import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; static byte[] hmacSHA256(byte[] message, byte[] key) ctex { S algorithm = "HmacSHA256"; Mac mac = Mac.getInstance(algorithm); mac.init(new SecretKeySpec(key, algorithm)); ret mac.doFinal(message); } static byte[] hmacSHA256(S message, byte[] key) { ret hmacSHA256(toUtf8(message), key); }