Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Forevery1 committed Sep 29, 2017
1 parent f6c47c8 commit b25d0b5
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@

public class RC4_Utils {

/*private String Decry_RC4(byte[] data, String key) {
private String Decry(byte[] data, String key) {
if (data == null || key == null) {
return null;
}
return asString(RC4Base(data, key));
}*/
}

/**
* @param data 数据
* @param key 密钥
* @param Type 解密编码
* @return String
*/
public String Decry_RC4(String data, String key, String Type) {
public String Decry(String data, String key, String Type) {
try {
if (data == null || key == null) {
return null;
Expand All @@ -31,26 +31,26 @@ public String Decry_RC4(String data, String key, String Type) {
}
}

public String Decry_RC4(String data, String key) {
public String Decry(String data, String key) {
if (data == null || key == null) {
return null;
}
return new String(RC4Base(HexString2Bytes(data), key));
}

private byte[] Encry_RC4_(String data, String key) {
private byte[] Encry_Byte(String data, String key) {
if (data == null || key == null) {
return null;
}
byte b_data[] = data.getBytes();
return RC4Base(b_data, key);
}

public String Encry_RC4(String data, String key) {
public String Encry(String data, String key) {
if (data == null || key == null) {
return null;
}
return toHexString(asString(Encry_RC4_(data, key)));
return toHexString(asString(Encry_Byte(data, key)));
}

private String asString(byte[] buf) {
Expand Down

0 comments on commit b25d0b5

Please sign in to comment.