简体   繁体   English

在 Java 中提供各种 hash 算法(MD5、SHA1、SHA256 等)的库?

[英]Library providing various hash algorithms (MD5, SHA1, SHA256, etc) in Java?

Is there a simple library out there for Java in a Maven repository that will give me simple, one-liner hash methods for the popular hash functions such as MD5, SHA1, SHA256, and SHA512? Is there a simple library out there for Java in a Maven repository that will give me simple, one-liner hash methods for the popular hash functions such as MD5, SHA1, SHA256, and SHA512? I'd really hate to have to reinvent the wheel to do this.我真的很讨厌不得不重新发明轮子来做到这一点。

It's built-in: java.security.MessageDigest它是内置的: java.security.MessageDigest

The DigestUtils class of Apache Commons Codec is suitable for the purpose of simplifying the use of the MessageDigest class, which appears to be what you are attempting to use in the first place. Apache Commons Codec的 DigestUtils class 适用于简化 MessageDigest class 的使用,这似乎是您首先尝试使用的。

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

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