简体   繁体   English

在Java中使用HMAC-Whirlpool

[英]Using HMAC-Whirlpool in Java

My program has to use HMAC-sha256 and HMAC-whirlpool . 我的程序必须使用HMAC-sha256HMAC-whirlpool I use javax.crypto for the HMAC-sha256 algorithm and it works without problems. 我将javax.crypto用于HMAC-sha256算法,它可以正常工作。 But I got problems using HMAC-whirlpool . 但是我在使用HMAC-whirlpool遇到了问题。 I only found whirlpool. 我只找到漩涡。 Is there a way how I can use the whirlpool library and change it to become a HMAC-whirlpool algorithm? 有没有一种方法可以使用漩涡库并将其更改为HMAC-whirlpool算法?

You can use HMacWhirpool class: 您可以使用HMacWhirpool类:

This class implements the HMAC (Keyed-Hashing for Message Authentication) algorithm as defined in RFC 2104 with WHIRLPOOL as message digest algorithm. 此类使用WHIRLPOOL作为消息摘要算法来实现RFC 2104中定义的HMAC(消息认证密钥哈希)算法。

Usage: 用法:

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

You can find more info here 您可以在这里找到更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM