This commit is contained in:
Looly
2024-03-01 15:53:23 +08:00
parent 5c1ffbcc0c
commit e3f4a6a20a
5 changed files with 11 additions and 11 deletions

View File

@@ -205,7 +205,7 @@ public class RSATest {
final byte[] keyBytes = Base64.decode(publicKeyStr);
final PublicKey publicKey = KeyUtil.generateRSAPublicKey(keyBytes);
final byte[] data = RandomUtil.randomStringLower("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 16).getBytes();
final byte[] data = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 16).getBytes();
//长度不满足128补0
final byte[] finalData = ArrayUtil.resize(data, 128);

View File

@@ -30,7 +30,7 @@ public class FPETest {
final FPE fpe = new FPE(FPE.FPEMode.FF1, keyBytes, numberMapper, null);
// 原始数据
final String phone = RandomUtil.randomStringLower("A0123456789", 13);
final String phone = RandomUtil.randomString("A0123456789", 13);
final String encrypt = fpe.encrypt(phone);
// 加密后与原密文长度一致
Assertions.assertEquals(phone.length(), encrypt.length());
@@ -49,7 +49,7 @@ public class FPETest {
final FPE fpe = new FPE(FPE.FPEMode.FF3_1, keyBytes, numberMapper, null);
// 原始数据
final String phone = RandomUtil.randomStringLower("A0123456789", 13);
final String phone = RandomUtil.randomString("A0123456789", 13);
final String encrypt = fpe.encrypt(phone);
// 加密后与原密文长度一致
Assertions.assertEquals(phone.length(), encrypt.length());