Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyrain2012 committed Feb 6, 2021
1 parent daffaac commit 4e39ac5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/cn/wildfirechat/app/DESUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static String encrypt(String data) {
//JDK1.8及以上可直接使用Base64,JDK1.7及以下可以使用BASE64Encoder
//Android平台可以使用android.util.Base64
String s = new String(Base64.getEncoder().encode(bytes));
s = s.replace("/", "%2F").replace("+","%2B").replace("=","%3D");
s = s.replace("/", "~").replace("+","-").replace("=","_");
return s;
} catch (Exception e) {
e.printStackTrace();
Expand All @@ -86,7 +86,7 @@ public static String decrypt(String data) {
if (data == null)
return null;
try {
data = data.replace("%2F", "/").replace("%2B", "+").replace("%3D", "=");
data = data.replace("~", "/").replace("-", "+").replace("_", "=");
Key secretKey = generateKey(password);
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
IvParameterSpec iv = new IvParameterSpec(IV_PARAMETER.getBytes(CHARSET));
Expand Down

0 comments on commit 4e39ac5

Please sign in to comment.