1 public class test { 2 public static void main(String[] args) { 3 //所需加密的参数 即 密码 4 String source = "123"; 5 //一般为用户名 或 随机数 6 String salt = "Shiro"; 7 //加密次数 8 int hashIterations = 1024; 9 SimpleHash sh = new SimpleHash("md5", source, salt, hashIterations); 10 //打印最终结果 11 System.out.println(sh.toString()); 12 13 14 } 15 }