Hutool是一个Java工具包,它提供了许多实用的工具类,包括加密工具。可以使用Hutool的DigestUtil类来进行SHA-256加密。
以下是一个示例代码,演示如何使用Hutool的DigestUtil类进行SHA-256加密:
import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.DigestUtil;
public class HutoolSha256Example {
public static void main(String[] args) {
String input = "Hello World";
String sha256 = DigestUtil.sha256Hex(input);
System.out.println(sha256);
}
}
本文介绍了HutoolJava工具包中的DigestUtil类,展示了如何使用它进行SHA-256加密,提供了一个简单的示例代码来演示操作过程。
1026

被折叠的 条评论
为什么被折叠?



