有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Java中使用HMACWhirlpool的密码学

我的程序必须使用HMAC-sha256HMAC-whirlpool。我使用javax.crypto作为HMAC-sha256算法,它可以毫无问题地工作。但是我在使用^{时遇到了问题。我只找到了惠而浦。有没有办法使用whirlpool库并将其更改为HMAC-whirlpool算法


共 (1) 个答案

  1. # 1 楼答案

    您可以使用HMacWhirpool类:

    This class implements the HMAC (Keyed-Hashing for Message Authentication) algorithm as defined in RFC 2104 with WHIRLPOOL as message digest algorithm.

    用法:

    Mac hmac = Mac.getInstance("HMAC/WHIRLPOOL");
    hmac.init(secret_key);
     byte[] mac_data = hmac.doFinal(data);
    

    你可以找到更多信息here