Java
Just out of curiosity I decided to write a simple block of code that outputs code that does not look obfuscated.
Here is the generator code
package metaobfuscate;
import java.util.Random;
import java.util.Scanner;
/**
*
* @author rohan
*/
public class MetaObfuscate {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String s = (new Scanner(System.in)).nextLine().toLowerCase();
int i = 0;
int numChar = s.length();
String randomlyGenerated;
String alphabet = " abcdefghijklmnopqrstuvwxyz!?.";
do {
Random rand = new Random(i);
randomlyGenerated = "";
i++;
for (int j = 0; j < numChar; j++) {
randomlyGenerated += alphabet.charAt((int) (rand.nextDouble() * alphabet.length()));
}
} while (!s.equals(randomlyGenerated));
i--;
System.out.println("import java.util.Random;\n//Simple demonstration of generating random characters");
System.out.println("public class RandomNessTest {");
System.out.println("\t//args are the command line arguments");
System.out.println("\tpublic static void main(String[] args){");
System.out.println("\tRandom rand = new Random(" + i + ");//replace the seed with whatever seed you want");
System.out.println("\t//the seed was generated by random keyboard mashing");
System.out.println("\tString alphabet = \" abcdefghijklmnopqrstuvwxyz!?.\";");
System.out.println("\tfor(int i = 0;i<" + numChar + ";i++)");
System.out.println("\t\tSystem.out.print(alphabet.charAt((int)(rand.nextDouble()*alphabet.length())));");
System.out.println("\t//print out a few random characters");
System.out.println("\t}\n}");
}
}
It takes in whatever string you wish to obfuscate and outputs a program that looks reliable as output. It takes exponential runtime with larger strings, but it works great for strings of length 1-5. The outputted program claims to be a tutorial, and is even formatted nicely!
import java.util.Random;
//Simple demonstration of generating random characters
public class RandomNessTest {
//args are the command line arguments
public static void main(String[] args){
Random rand = new Random(2727915);//replace the seed with whatever seed you want
//the seed was generated by random keyboard mashing
String alphabet = " abcdefghijklmnopqrstuvwxyz!?.";
for(int i = 0;i<5;i++)
System.out.print(alphabet.charAt((int)(rand.nextDouble()*alphabet.length())));
//print out a few random characters
}
}