mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
fix BaseN
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.hutool.core.codec;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -14,6 +15,24 @@ public class Base32Test {
|
||||
|
||||
String decodeStr = Base32.decodeStr(encode);
|
||||
Assert.assertEquals(a, decodeStr);
|
||||
|
||||
// 支持小写模式解码
|
||||
decodeStr = Base32.decodeStr(encode.toLowerCase());
|
||||
Assert.assertEquals(a, decodeStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hexEncodeAndDecodeTest(){
|
||||
String a = "伦家是一个非常长的字符串";
|
||||
String encode = Base32.encodeHex(StrUtil.utf8Bytes(a));
|
||||
Assert.assertEquals("SIUADPDEMRJ9HBV4N20E9E5AT6EPTPDON3KPBFV7JA2EBBCNSUMADP5OM8======", encode);
|
||||
|
||||
String decodeStr = Base32.decodeStrHex(encode);
|
||||
Assert.assertEquals(a, decodeStr);
|
||||
|
||||
// 支持小写模式解码
|
||||
decodeStr = Base32.decodeStrHex(encode.toLowerCase());
|
||||
Assert.assertEquals(a, decodeStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user