refactor(all): change sql to postgresql
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package xin.merlin.myblog_server.utils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
@@ -42,13 +43,14 @@ public class SHA256Util {
|
||||
/**
|
||||
* 使用用户ID生成盐值,并对密码进行加密
|
||||
* @param password 用户输入的密码
|
||||
* @param userId 用户ID
|
||||
* @return 加密后的密码哈希值
|
||||
*/
|
||||
public String encryptPassword(String password, String userId) {
|
||||
// 先对用户ID进行SHA-256加密,得到盐值
|
||||
String salt = encryptSHA256(userId);
|
||||
@Value("${jwt.salt}")
|
||||
private String salt;
|
||||
|
||||
public String encryptPassword(String password) {
|
||||
String s = encryptSHA256(salt);
|
||||
// 将盐值与密码拼接后进行SHA-256加密
|
||||
return encryptSHA256(salt +salt + password + salt);
|
||||
return encryptSHA256(s +s + password + s);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user