hex加密解密算法

select * from sys_user where login_name in( select login_name from SYS_USER t group by login_name  HAVING count(login_name)>1);


/**
 * 生成安全的密码,生成随机的16位salt并经过1024次 sha-1 hash
 */
public static String entryptPassword(String plainPassword) {
byte[] salt = Digests.generateSalt(SALT_SIZE);
byte[] hashPassword = Digests.sha1(plainPassword.getBytes(), salt, HASH_INTERATIONS);
return Encodes.encodeHex(salt) + Encodes.encodeHex(hashPassword);
}
public static final int HASH_INTERATIONS = 1024;
public static final int SALT_SIZE = 8;


/**
 * 解密
 */


 byte[] salt =Encodes.decodeHex("247dd81a8c34b4dc");
 byte[] hashPassword = Digests.sha1("www.hztywl.cn".getBytes(), salt, HASH_INTERATIONS);
 String ss = Encodes.encodeHex(salt) + Encodes.encodeHex(hashPassword);
 System.out.println(ss);

你可能感兴趣的:(java)