mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add qrconfig
This commit is contained in:
@@ -18,6 +18,7 @@ public class BCD {
|
||||
* @return BCD
|
||||
*/
|
||||
public static byte[] strToBcd(String asc) {
|
||||
Assert.notNull(asc, "ASCII must not be null!");
|
||||
int len = asc.length();
|
||||
final int mod = len % 2;
|
||||
if (mod != 0) {
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package cn.hutool.core.codec;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
|
||||
/**
|
||||
* 凯撒密码实现<br>
|
||||
* 算法来自:<a href="https://github.com/zhaorenjie110/SymmetricEncryptionAndDecryption">https://github.com/zhaorenjie110/SymmetricEncryptionAndDecryption</a>
|
||||
@@ -19,6 +21,7 @@ public class Caesar {
|
||||
* @return 加密后的内容
|
||||
*/
|
||||
public static String encode(final String message, final int offset) {
|
||||
Assert.notNull(message, "message must be not null!");
|
||||
final int len = message.length();
|
||||
final char[] plain = message.toCharArray();
|
||||
char c;
|
||||
@@ -40,6 +43,7 @@ public class Caesar {
|
||||
* @return 解密后的内容
|
||||
*/
|
||||
public static String decode(final String cipherText, final int offset) {
|
||||
Assert.notNull(cipherText, "cipherText must be not null!");
|
||||
final int len = cipherText.length();
|
||||
final char[] plain = cipherText.toCharArray();
|
||||
char c;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package cn.hutool.core.codec;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.text.CharPool;
|
||||
import cn.hutool.core.text.StrUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
@@ -183,6 +184,7 @@ public class PercentCodec implements Encoder<byte[], byte[]>, Serializable {
|
||||
* @return PercentCodec
|
||||
*/
|
||||
public static Builder of(final CharSequence chars) {
|
||||
Assert.notNull(chars, "chars must not be null");
|
||||
final Builder builder = of(new PercentCodec());
|
||||
final int length = chars.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
@@ -44,6 +44,7 @@ public class PunyCode {
|
||||
* @throws UtilException 计算异常
|
||||
*/
|
||||
public static String encode(final CharSequence input, final boolean withPrefix) throws UtilException {
|
||||
Assert.notNull(input, "input must not be null!");
|
||||
int n = INITIAL_N;
|
||||
int delta = 0;
|
||||
int bias = INITIAL_BIAS;
|
||||
@@ -126,6 +127,7 @@ public class PunyCode {
|
||||
* @throws UtilException 计算异常
|
||||
*/
|
||||
public static String decode(String input) throws UtilException {
|
||||
Assert.notNull(input, "input must not be null!");
|
||||
input = StrUtil.removePrefixIgnoreCase(input, PUNY_CODE_PREFIX);
|
||||
|
||||
int n = INITIAL_N;
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package cn.hutool.core.codec;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
|
||||
/**
|
||||
* RotN(rotate by N places),回转N位密码,是一种简易的替换式密码,也是过去在古罗马开发的凯撒加密的一种变体。<br>
|
||||
* 代码来自:https://github.com/orclight/jencrypt
|
||||
* 代码来自:<a href="https://github.com/orclight/jencrypt">https://github.com/orclight/jencrypt</a>
|
||||
*
|
||||
* @author looly,shuzhilong
|
||||
* @author looly, shuzhilong
|
||||
* @since 4.4.1
|
||||
*/
|
||||
public class Rot {
|
||||
@@ -30,11 +32,11 @@ public class Rot {
|
||||
* Rot-13编码
|
||||
*
|
||||
* @param message 被编码的消息
|
||||
* @param isEnocdeNumber 是否编码数字
|
||||
* @param isEncodeNumber 是否编码数字
|
||||
* @return 编码后的字符串
|
||||
*/
|
||||
public static String encode13(final String message, final boolean isEnocdeNumber) {
|
||||
return encode(message, 13, isEnocdeNumber);
|
||||
public static String encode13(final String message, final boolean isEncodeNumber) {
|
||||
return encode(message, 13, isEncodeNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,15 +44,15 @@ public class Rot {
|
||||
*
|
||||
* @param message 被编码的消息
|
||||
* @param offset 位移,常用位移13
|
||||
* @param isEnocdeNumber 是否编码数字
|
||||
* @param isEncodeNumber 是否编码数字
|
||||
* @return 编码后的字符串
|
||||
*/
|
||||
public static String encode(final String message, final int offset, final boolean isEnocdeNumber) {
|
||||
public static String encode(final String message, final int offset, final boolean isEncodeNumber) {
|
||||
final int len = message.length();
|
||||
final char[] chars = new char[len];
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
chars[i] = encodeChar(message.charAt(i), offset, isEnocdeNumber);
|
||||
chars[i] = encodeChar(message.charAt(i), offset, isEncodeNumber);
|
||||
}
|
||||
return new String(chars);
|
||||
}
|
||||
@@ -85,6 +87,7 @@ public class Rot {
|
||||
* @return 解码后的字符串
|
||||
*/
|
||||
public static String decode(final String rot, final int offset, final boolean isDecodeNumber) {
|
||||
Assert.notNull(rot, "rot must not be null");
|
||||
final int len = rot.length();
|
||||
final char[] chars = new char[len];
|
||||
|
||||
|
Reference in New Issue
Block a user