mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix code
This commit is contained in:
parent
5c1ffbcc0c
commit
e3f4a6a20a
@ -636,7 +636,7 @@ public class RandomUtil {
|
||||
* @return 随机字符串
|
||||
*/
|
||||
public static String randomString(final int length) {
|
||||
return randomStringLower(BASE_CHAR_NUMBER, length);
|
||||
return randomString(BASE_CHAR_NUMBER, length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -646,7 +646,7 @@ public class RandomUtil {
|
||||
* @return 随机字符串
|
||||
*/
|
||||
public static String randomStringLower(final int length) {
|
||||
return randomStringLower(BASE_CHAR_NUMBER_LOWER, length);
|
||||
return randomString(BASE_CHAR_NUMBER_LOWER, length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -657,7 +657,7 @@ public class RandomUtil {
|
||||
* @since 4.0.13
|
||||
*/
|
||||
public static String randomStringUpper(final int length) {
|
||||
return randomStringLower(BASE_CHAR_NUMBER_LOWER, length).toUpperCase();
|
||||
return randomString(BASE_CHAR_NUMBER_LOWER, length).toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -670,7 +670,7 @@ public class RandomUtil {
|
||||
public static String randomStringWithoutStr(final int length, final String elemData) {
|
||||
String baseStr = BASE_CHAR_NUMBER_LOWER;
|
||||
baseStr = StrUtil.removeAll(baseStr, elemData.toLowerCase().toCharArray());
|
||||
return randomStringLower(baseStr, length);
|
||||
return randomString(baseStr, length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -680,7 +680,7 @@ public class RandomUtil {
|
||||
* @return 随机字符串
|
||||
*/
|
||||
public static String randomNumbers(final int length) {
|
||||
return randomStringLower(BASE_NUMBER, length);
|
||||
return randomString(BASE_NUMBER, length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -690,7 +690,7 @@ public class RandomUtil {
|
||||
* @param length 字符串的长度
|
||||
* @return 随机字符串
|
||||
*/
|
||||
public static String randomStringLower(final String baseString, int length) {
|
||||
public static String randomString(final String baseString, int length) {
|
||||
if (StrUtil.isEmpty(baseString)) {
|
||||
return StrUtil.EMPTY;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class RandomUtilTest {
|
||||
|
||||
@Test
|
||||
public void randomStringOfLengthTest(){
|
||||
final String s = RandomUtil.randomStringLower("123", -1);
|
||||
final String s = RandomUtil.randomString("123", -1);
|
||||
Assertions.assertNotNull(s);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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());
|
||||
|
@ -46,7 +46,7 @@ public class RandomGenerator extends AbstractGenerator {
|
||||
|
||||
@Override
|
||||
public String generate() {
|
||||
return RandomUtil.randomStringLower(this.baseStr, this.length);
|
||||
return RandomUtil.randomString(this.baseStr, this.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user