PassUtil.kt
· 525 B · Kotlin
Raw
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
/**
* 密码工具类
* @author ThatCoder
*/
class PassUtil private constructor() {
companion object {
private val encoder = BCryptPasswordEncoder()
/**
* 密码加密
* @author ThatCoder
* @param password 密码
* @return 加密后的密码 length:60
*/
@JvmStatic
fun encode(password: String): String {
return encoder.encode(password)
}
}
}
1 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder |
2 | |
3 | /** |
4 | * 密码工具类 |
5 | * @author ThatCoder |
6 | */ |
7 | class PassUtil private constructor() { |
8 | companion object { |
9 | private val encoder = BCryptPasswordEncoder() |
10 | |
11 | /** |
12 | * 密码加密 |
13 | * @author ThatCoder |
14 | * @param password 密码 |
15 | * @return 加密后的密码 length:60 |
16 | */ |
17 | @JvmStatic |
18 | fun encode(password: String): String { |
19 | return encoder.encode(password) |
20 | } |
21 | } |
22 | } |