mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
SM2.signHex改名为signHexFromHex,原名标记废弃,避免歧义
This commit is contained in:
@@ -87,7 +87,7 @@ public class Hex {
|
||||
* @param data 被编码的字符串
|
||||
* @return 十六进制String
|
||||
*/
|
||||
public static String encodeStr(final String data) {
|
||||
public static String encodeStr(final CharSequence data) {
|
||||
return encodeStr(data, CharsetUtil.UTF_8);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Hex {
|
||||
* @param charset 编码
|
||||
* @return 十六进制String
|
||||
*/
|
||||
public static String encodeStr(final String data, final Charset charset) {
|
||||
public static String encodeStr(final CharSequence data, final Charset charset) {
|
||||
return encodeStr(ByteUtil.toBytes(data, charset), true);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class Hex {
|
||||
* @param hexStr 十六进制String
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String decodeStr(final String hexStr) {
|
||||
public static String decodeStr(final CharSequence hexStr) {
|
||||
return decodeStr(hexStr, CharsetUtil.UTF_8);
|
||||
}
|
||||
|
||||
@@ -133,9 +133,9 @@ public class Hex {
|
||||
* @param charset 编码
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String decodeStr(final String hexStr, final Charset charset) {
|
||||
public static String decodeStr(final CharSequence hexStr, final Charset charset) {
|
||||
if (StrUtil.isEmpty(hexStr)) {
|
||||
return hexStr;
|
||||
return StrUtil.toStringOrNull(hexStr);
|
||||
}
|
||||
return StrUtil.str(decode(hexStr), charset);
|
||||
}
|
||||
@@ -151,16 +151,6 @@ public class Hex {
|
||||
return StrUtil.str(decode(hexData), charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将十六进制字符串解码为byte[]
|
||||
*
|
||||
* @param hexStr 十六进制String
|
||||
* @return byte[]
|
||||
*/
|
||||
public static byte[] decode(final String hexStr) {
|
||||
return decode((CharSequence) hexStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将十六进制字符数组转换为字节数组
|
||||
*
|
||||
|
Reference in New Issue
Block a user