Skip to content

Commit 4fffeae

Browse files
committed
optimize structure
1 parent e38fe9f commit 4fffeae

3 files changed

Lines changed: 421 additions & 483 deletions

File tree

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,61 @@ taoyuan's AndroidUtils
1717
```
1818

1919
2. app build.gradle下添加依赖
20-
`compile 'com.github.seeways:AndroidUtils:1.1.6'`
20+
`compile 'com.github.seeways:AndroidUtils:1.1.7'`
21+
22+
# 2017.3.20
23+
新增EncodeUtils,EncryptUtils,StringUtils
24+
25+
- 字符串工具类 StringUtils
26+
+ 判空操作 `boolean isEmpty(String s)`
27+
+ 字符串是否相等(a String 1,b String2,isIgnoreCase是否忽略大小写)
28+
+ `isEquals(String a, String b,boolean isIgnoreCase)`
29+
30+
- 编码工具类 EncodeUtils
31+
+ 默认URL编码(UTF-8) `String urlDecode(String input)`
32+
+ 自定义字符集编码 `String urlDecode(String input, String charset)`
33+
+ Base64编码 `byte[] base64Encode(byte[] input)`
34+
+ Base64解码 `byte[] base64Decode(byte[] input)`
35+
+ Base64自定义flags编码 `byte[] base64Encode(byte[] input,int flags)`
36+
+ Base64自定义flags解码 ` byte[] base64Decode(byte[] input,int flags)`
37+
+ Html编码 `String htmlEncode(CharSequence input)`
38+
+ Html解码 `CharSequence htmlDecode(String input)`
39+
40+
- 加密工具类 EncryptUtils
41+
+ MD5系列
42+
* String To MD5 `String String2Md5(String data)`
43+
* String To MD5 `String String2Md5(String data, String salt)`
44+
* byte To MD5 `String byte2Md5(byte[] data)`
45+
* byte To MD5 `String byte2Md5(byte[] data, byte[] salt)`
46+
* MD5 进行hash加密 `byte[] encryptMD5(byte[] data)`
47+
+ AES系列
48+
* 关于AES要解释起来也不是一句两句能解释的,稍后我会写篇博客来阐述
49+
* 博客:
50+
* 简书:
51+
*
52+
* 配合Base64转码是常用的,转16进制可以理解为MD5运算
53+
*
54+
* 默认AES加密 `byte[] AESEncrypt(byte[] data, byte[] key)`
55+
* AES加密后转为Base64编码 `byte[] AES2Base64(byte[] data, byte[] key)`
56+
* AES加密后转为16进制 `String AES2Hex(byte[] data, byte[] key)`
57+
* 默认AES解密 `byte[] AESDecrypt(byte[] data, byte[] key)`
58+
* AES解密Base64编码密文 `byte[] decryptBase64AES(byte[] data, byte[] key)`
59+
* AES解密16进制密文 `byte[] decryptHexAES(String data, byte[] key)`
60+
61+
+ SHA系列(SHA1,SHA256,SHA512)
62+
* SHA1加密
63+
- `String SHA1Encrypt(String data)`
64+
- `String SHA1Encrypt(byte[] data)`
65+
- `byte[] SHA1Hash(byte[] data)`
66+
* SHA256加密
67+
- `String SHA256Encrypt(String data)`
68+
- `String SHA256Encrypt(byte[] data)`
69+
- `byte[] SHA256Hash(byte[] data)`
70+
* SHA512加密
71+
- `String SHA512Encrypt(String data)`
72+
- `String SHA512Encrypt(byte[] data)`
73+
- `byte[] SHA512Hash(byte[] data)`
74+
2175

2276

2377
# 2017.3.15

myutils/src/main/java/com/jty/myutils/utils/EncodeUtils.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
import android.os.Build;
44
import android.text.Html;
5+
import android.util.Base64;
56

67
import java.io.UnsupportedEncodingException;
78
import java.net.URLDecoder;
89

910
/**
1011
* @author TaoYuan
1112
* @time 2017/3/20 0020
12-
* @desc
13+
* @desc 编码工具类
1314
*/
1415

1516
public class EncodeUtils {
1617

1718
/**
18-
* 默认编码
19+
* 默认URL编码
1920
* @param input
2021
* @return
2122
*/
@@ -37,8 +38,33 @@ public static String urlDecode(String input, String charset) {
3738
}
3839
}
3940

41+
/** Base64系列 **/
4042

43+
/**
44+
* Base64编码
45+
*/
46+
public static byte[] base64Encode(byte[] input) {
47+
return Base64.encode(input, Base64.DEFAULT);
48+
}
49+
/**
50+
* Base64自定义flags编码
51+
*/
52+
public static byte[] base64Encode(byte[] input,int flags) {
53+
return Base64.encode(input, flags);
54+
}
4155

56+
/**
57+
* Base64解码
58+
*/
59+
public static byte[] base64Decode(byte[] input) {
60+
return Base64.decode(input, Base64.DEFAULT);
61+
}
62+
/**
63+
* Base64自定义flags解码
64+
*/
65+
public static byte[] base64Decode(byte[] input,int flags) {
66+
return Base64.decode(input, flags);
67+
}
4268

4369
/**
4470
* Html编码

0 commit comments

Comments
 (0)