Logged In: NO

package jode.obfuscator.modules;
import jode.obfuscator.*;
import jode.bytecode.*;
import java.util.*;

public class StringMangler implements
CodeTransformer,Opcodes,OptionHandler {
int numC;
Reference mangler;

public void setOption(String opt, Collection val) {
if(opt.startsWith("decoder")) {
String s = (String) val.iterator
().next();
mangler = Reference.getReference(
"L"+s+";",
// <-- the class where you put the _mangle function
"_mangle",

"(Ljava/lang/String;I)Ljava/lang/String;");
}
}
public void transformCode(BytecodeInfo bc) {
if(mangler==null) throw new Error("You need
to set the decoder parameter.");
ListIterator lit = bc.getInstructions
().listIterator();
while(lit.hasNext()) {
Instruction ldc = (Instruction)
lit.next();

int op = ldc.getOpcode();
// ldc?
if(op!=opc_ldc) continue;

Object obj = ldc.getConstant();
if(obj instanceof String) {

String s = (String)obj;

int ofs = (numC++)*17 %
_maxStr;
if(numC>=_maxStr) throw new
Error("Out of buffer space");

ldc.setConstant(_mangle
(s,ofs));

Instruction loadInt = new
Instruction(opc_ldc);
loadInt.setConstant(new
Integer(ofs));
lit.add(loadInt);

Instruction call = new
Instruction(opc_invokestatic);
call.setReference(mangler);
lit.add(call);
}
}
}

// -- snip
static final int _maxStr = 200;
static String[] _cache = new String[_maxStr];
public static String _mangle(String s0,int i) {
String s;
if((s=_cache[i])!=null) return s;
char[] c = s0.toCharArray();
for(int j=c.length;j-->0;) c[j]^=42;
return _cache[i] = new String(c);
}
// -- snip

}