SHA512加密(参考:https://blog.csdn.net/zdj_Develop/article/details/89326621?utm_medium=distribute.pc_relevant.none-task-blog-baidulandingword-2&spm=1001.2101.3001.4242)
public static String encryptPasswordWithSHA512(String password) { try { MessageDigest messageDigest = MessageDigest.getInstance("SHA-512"); //创建SHA512类型的加密对象 messageDigest.update(password.getBytes()); byte[] bytes = messageDigest.digest(); StringBuffer strHexString = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xff & bytes[i]); if (hex.length() == 1) { strHexString.append('0'); } strHexString.append(hex); } String result = strHexString.toString(); return result; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } }
其他加密 参考:
https://blog.csdn.net/xmt1139057136/article/details/88177934?utm_medium=distribute.pc_relevant.none-task-blog-baidulandingword-2&spm=1001.2101.3001.4242