md5解密java代码
时间: 2023-12-19 08:31:51 浏览: 94
```java
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Decrypt {
public static void main(String[] args) {
String input = "your_input_string";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : messageDigest) {
sb.append(String.format("%02x", b));
}
String md5 = sb.toString();
System.out.println("MD5 hash: " + md5);
} catch (NoSuchAlgorithmException e) {
System.err.println("MD5 algorithm not found"); }
}
}
```
阅读全文