源代码:
package com.oracle.core;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Scanner;
public class Knife
{
static Scanner scanner=new Scanner(System.in);
public static void main(String[] args) throws NoSuchAlgorithmException, CloneNotSupportedException
{
Knife knife = new Knife();
System.out.println("请输入您要加密的数");
String str=scanner.next();
MessageDigest instance = MessageDigest.getInstance("MD5");
instance.update(str.getBytes());
MessageDigest tc1 = (MessageDigest) instance.clone();
byte[] digest = tc1.digest();
String md5 = knife.convertbyte2String(digest);
System.out.println("请输入您要加密的次数:");
int n=scanner.nextInt();
String md51 = md5("123456",n );
System.out.println(str+"加密"+n+"次后的结果为"+"\n"+md51);
}
public static String md5(String keyword, int count) throws NoSuchA