113 |
brianR |
1 |
/* */ package net.brutex.xservices.util;
|
|
|
2 |
/* */
|
|
|
3 |
/* */ import java.io.PrintStream;
|
|
|
4 |
/* */
|
|
|
5 |
/* */ public class CvsPassword
|
|
|
6 |
/* */ {
|
|
|
7 |
/* 46 */ private static final char[] LOOKUP_TABLE = {
|
|
|
8 |
/* 47 */ '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', 'r', 'x', '5',
|
|
|
9 |
/* 48 */ 'O', '\000', 'm', 'H', 'l', 'F', '@', 'L', 'C', 't', 'J', 'D', 'W', 'o', '4', 'K',
|
|
|
10 |
/* 49 */ 'w', '1', '"', 'R', 'Q', '_', 'A', 'p', 'V', 'v', 'n', 'z', 'i', ')', '9',
|
|
|
11 |
/* 50 */ 'S', '+', '.', 'f', '(', 'Y', '&', 'g', '-', '2', '*', '{', '[', '#', '}', '7',
|
|
|
12 |
/* 51 */ '6', 'B', '|', '~', ';', '/', '\\', 'G', 's', 'N', 'X', 'k', 'j', '8',
|
|
|
13 |
/* 52 */ '\000', 'y', 'u', 'h', 'e', 'd', 'E', 'I', 'c', '?', '^', ']', '\'', '%', '=', '0',
|
|
|
14 |
/* 53 */ ':', 'q', ' ', 'Z', ',', 'b', '<', '3', '!', 'a', '>', 'M', 'T', 'P', 'U' };
|
|
|
15 |
/* */
|
|
|
16 |
/* */ public static String encode(String clearText)
|
|
|
17 |
/* */ {
|
|
|
18 |
/* 68 */ char[] encoded = new char[clearText.length() + 1];
|
|
|
19 |
/* 69 */ encoded[0] = 'A';
|
|
|
20 |
/* */
|
|
|
21 |
/* 72 */ int counter = 1;
|
|
|
22 |
/* 73 */ for (char c : clearText.toCharArray())
|
|
|
23 |
/* */ {
|
|
|
24 |
/* 75 */ if ((c == '`') || (c == '$') || (c < ' '))
|
|
|
25 |
/* */ {
|
|
|
26 |
/* 77 */ throw new IllegalArgumentException(
|
|
|
27 |
/* 78 */ "Illegal character was found in clear password.");
|
|
|
28 |
/* */ }
|
|
|
29 |
/* */
|
|
|
30 |
/* 81 */ encoded[(counter++)] = LOOKUP_TABLE[c];
|
|
|
31 |
/* */ }
|
|
|
32 |
/* */
|
|
|
33 |
/* 84 */ return String.valueOf(encoded);
|
|
|
34 |
/* */ }
|
|
|
35 |
/* */
|
|
|
36 |
/* */ public static String decode(String encodedPassword)
|
|
|
37 |
/* */ {
|
|
|
38 |
/* 98 */ String rtn = null;
|
|
|
39 |
/* */
|
|
|
40 |
/* 100 */ if ((encodedPassword != null) && (encodedPassword.length() > 0))
|
|
|
41 |
/* */ {
|
|
|
42 |
/* 102 */ if (encodedPassword.startsWith("A"))
|
|
|
43 |
/* */ {
|
|
|
44 |
/* 104 */ rtn = encode(encodedPassword.substring(1)).substring(1);
|
|
|
45 |
/* */ }
|
|
|
46 |
/* */ else
|
|
|
47 |
/* */ {
|
|
|
48 |
/* 108 */ rtn = encode(encodedPassword).substring(1);
|
|
|
49 |
/* */ }
|
|
|
50 |
/* */ }
|
|
|
51 |
/* */
|
|
|
52 |
/* 112 */ return rtn;
|
|
|
53 |
/* */ }
|
|
|
54 |
/* */
|
|
|
55 |
/* */ public static void main(String[] sArgs)
|
|
|
56 |
/* */ {
|
|
|
57 |
/* 117 */ String TEST_WORD = "i07w91";
|
|
|
58 |
/* 118 */ String encoded = encode("i07w91");
|
|
|
59 |
/* 119 */ System.out.println("Encoded: <" + encoded + ">");
|
|
|
60 |
/* 120 */ String decoded = decode(encoded);
|
|
|
61 |
/* 121 */ System.out.println("Decoded: <" + decoded + ">");
|
|
|
62 |
/* 122 */ System.out.println(decoded.equals("i07w91") ? "Test Passed" : "Test Failed");
|
|
|
63 |
/* */ }
|
|
|
64 |
/* */ }
|
94 |
brianR |
65 |
|
113 |
brianR |
66 |
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
|
|
|
67 |
* Qualified Name: net.brutex.xservices.util.CvsPassword
|
|
|
68 |
* JD-Core Version: 0.6.2
|
|
|
69 |
*/
|