有许多理由试图混淆输入。这些措施包括防止反编译,以及成为一名新成员。
考虑到这一点,如果你选择接受的话,你的挑战就是编写一个元混淆器。您的代码必须在某些语言X中以字符串的形式接收输入,并以X语言输出输出输入字符串的程序。
规则
制胜标准
尽管该由你来决定哪个问题值得你投赞成票。这是指导方针。
dr输出一个输出输入的程序,但是很难理解正在发生的事情。尽管许多人已经讨论过这个问题(尤其是javascript),甚至还有python。我没有看到任何任意语言的这种程序的正式存储库。
发布于 2016-07-02 22:32:20
出于好奇,我决定编写一个简单的代码块,它输出的代码看起来并不模糊。这是生成器代码
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}");
}
}它接受任何你想混淆的字符串,并输出一个看起来像输出一样可靠的程序。对于较大的字符串,它需要指数运行时,但是对于长度为1-5的字符串来说,它工作得很好。输出的程序声称是一个教程,甚至是很好的格式化!
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
}
}https://codegolf.stackexchange.com/questions/84334
复制相似问题