优化验证码发送

This commit is contained in:
zhuyijun 2022-12-12 17:42:20 +08:00
parent daf2427c4a
commit 3d2ad88116
2 changed files with 4 additions and 1 deletions

View File

@ -94,7 +94,7 @@ public class LoginServiceImpl implements LoginService {
@Override @Override
public SmsResponse sendLoginCode(String phone) { public SmsResponse sendLoginCode(String phone) {
int smsCode = RandomUtils.nextInt(10000, 99999); int smsCode = RandomUtils.nextInt(100000, 999999);
String code = redisTemplateHandler.get(CommonRedisKeyConstant.SMS_LOGIN + phone); String code = redisTemplateHandler.get(CommonRedisKeyConstant.SMS_LOGIN + phone);
int count = 1; int count = 1;
if (StringUtils.hasLength(code)) { if (StringUtils.hasLength(code)) {

View File

@ -190,6 +190,7 @@ public class SM4 {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String iv = SM4.generateKey(); String iv = SM4.generateKey();
System.out.println(iv); System.out.println(iv);
System.out.println("加密:---------");
String v = SM4.encrypt(iv, """ String v = SM4.encrypt(iv, """
晚日照空矶采莲承晚晖 晚日照空矶采莲承晚晖
风起湖难渡莲多采未稀 风起湖难渡莲多采未稀
@ -199,7 +200,9 @@ public class SM4 {
System.out.println(v); System.out.println(v);
String digest = SM3.digest(v); String digest = SM3.digest(v);
System.out.println(digest); System.out.println(digest);
System.out.println("解密:---------");
System.out.println(SM4.decrypt(iv, v, iv)); System.out.println(SM4.decrypt(iv, v, iv));
System.out.println("解密:---------");
System.out.println(SM4.decrypt("864669EB9E57E15C923E1003CBEA8872", "6a05d74bda1f2a41c0b47605b06ef638", "fedcba98765432100123456789abcdef")); System.out.println(SM4.decrypt("864669EB9E57E15C923E1003CBEA8872", "6a05d74bda1f2a41c0b47605b06ef638", "fedcba98765432100123456789abcdef"));
} }