Java String Descrypt Decrypt(String str)

Here you can find the source of Decrypt(String str)

Description

Decrypt

License

Apache License

Declaration

public static String Decrypt(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String Decrypt(String str) {
        return encryStr("IBMExtract", Unicode2Str(str));
    }// ww w.  jav a 2 s . c  o  m

    private static String encryStr(String encKey, String toEnc) {
        int t = 0;
        int encKeyI = 0;
        while (t < encKey.length()) {
            encKeyI += encKey.charAt(t);
            t++;
        }
        return encry(encKeyI, toEnc);
    }

    private static String Unicode2Str(String s) {
        int i = 0;
        int len = s.length();

        StringBuffer sb = new StringBuffer(len);
        while (i < len) {
            String t = s.substring(i, i + 4);
            char c = (char) Integer.parseInt(t, 16);
            i += 4;
            sb.append(c);
        }
        return sb.toString();
    }

    private static String encry(int encKey, String toEnc) {
        int t = 0;
        String tog = "";
        if (encKey > 0) {
            while (t < toEnc.length()) {
                int a = toEnc.charAt(t);
                int c = a ^ encKey;
                char d = (char) c;
                tog = tog + d;
                t++;
            }
        }
        return tog;
    }
}

Related

  1. decrypt(String inString)
  2. decrypt(String s)
  3. decrypt(String s)
  4. decrypt(String s, int offset)
  5. decrypt(String src)
  6. decrypt(String str)
  7. decrypt(String str)
  8. decrypt(String str)
  9. decrypt(String string)