Skip to content

Commit

Permalink
feat(Crypt): 重构加密方法增加密码明文拼接过程
Browse files Browse the repository at this point in the history
  • Loading branch information
shulng committed Jun 8, 2024
1 parent 2208eb9 commit ef237fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/cc/baka9/catseedlogin/util/Crypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ public class Crypt {
private static final char[] CRYPTCHARS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};

public static String encrypt(final String name, final String password){
final String text = "ÜÄaeut//&/=I " + password + "7421€547" + name + "__+IÄIH§%NK " + password;
StringBuilder sb = new StringBuilder();
sb.append("ÜÄaeut//&/=I ").append(password).append("7421€547").append(name).append("__+IÄIH§%NK ").append(password);
String text = sb.toString();
try {
final MessageDigest md = MessageDigest.getInstance("SHA-512");
md.update(text.getBytes(StandardCharsets.UTF_8), 0, text.length());
Expand All @@ -19,7 +21,7 @@ public static String encrypt(final String name, final String password){
}
}

public static String byteArrayToHexString(byte... args){
public static String byteArrayToHexString(byte[] args){
char[] chars = new char[args.length * 2];
for (int i = 0; i < args.length; i++) {
chars[(i * 2)] = CRYPTCHARS[(args[i] >> 4 & 0xF)];
Expand Down

0 comments on commit ef237fe

Please sign in to comment.