Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
62 lines (52 loc) · 1.91 KB

File metadata and controls

executable file
·
62 lines (52 loc) · 1.91 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package array;
/**
* 自定义的英文和数字转码(在索引中找到值,固定位置转移)
*/
public class Code {
private static char[] base64EncodeChars = new char[]{'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'};
private final static int offSize = 3;
public static void main(String[] args) {
String value = "yahier";
value = addIndex(value);
System.out.println("增加偏移量后的数据:" + value);
value = subIndex(value);
System.out.println("减少偏移量后的数据:" + value);
}
/**
* 获取增加偏移量后的值
*/
private static String addIndex(String str) {
StringBuffer sb = new StringBuffer();
char[] data = str.toCharArray();
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < base64EncodeChars.length; j++) {
if (base64EncodeChars[j] == data[i]) {
sb.append(base64EncodeChars[j + offSize]);
continue;
}
}
}
return sb.toString();
}
/**
* 获取减少偏移量后的值
*/
private static String subIndex(String str) {
StringBuffer sb = new StringBuffer();
char[] data = str.toCharArray();
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < base64EncodeChars.length; j++) {
if (base64EncodeChars[j] == data[i]) {
sb.append(base64EncodeChars[j - offSize]);
continue;
}
}
}
return sb.toString();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.