Java代码1234567891011121314151617181920212223242526package com.ledao;import org.apache.shiro.crypto.SecureRandomNumberGenerator;import org.apache.shiro.crypto.hash.SimpleHash;/** * @author LeDao * @company * @create 2021-09-14 11:10 */public class Test { public static void main(String[] args) { //原始密码 String password = "123456"; //随机盐值 String salt = new SecureRandomNumberGenerator().nextBytes().toString(); //加密次数 int times = 2; //加密算法 String encryptName = "md5"; //加密后的密码 String encodePassword = new SimpleHash(encryptName, password, salt, times).toString(); System.out.println(encodePassword); }} 测试每次的加密结果都不同,因为每次的盐值都不同