MCPcopy Create free account
hub / github.com/Xiaoc7r/CityHub / encode

Method encode

src/main/java/com/hmdp/utils/PasswordEncoder.java:11–16  ·  view source on GitHub ↗
(String password)

Source from the content-addressed store, hash-verified

9public class PasswordEncoder {
10
11 public static String encode(String password) {
12 // 生成盐
13 String salt = RandomUtil.randomString(20);
14 // 加密
15 return encode(password,salt);
16 }
17 private static String encode(String password, String salt) {
18 // 加密
19 return salt + "@" + DigestUtils.md5DigestAsHex((password + salt).getBytes(StandardCharsets.UTF_8));

Callers 1

matchesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected