首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >元混淆字符串

元混淆字符串
EN

Code Golf用户
提问于 2016-07-02 22:32:20
回答 1查看 352关注 0票数 1

有许多理由试图混淆输入。这些措施包括防止反编译,以及成为一名新成员。

考虑到这一点,如果你选择接受的话,你的挑战就是编写一个元混淆器。您的代码必须在某些语言X中以字符串的形式接收输入,并以X语言输出输出输入字符串的程序。

规则

  1. 不允许有标准漏洞
  2. 应该很难判断输出是否打印任何内容(即代码应该被严重混淆)。
  3. 您的程序应该是可测试的
  4. 加密方法是允许的,但不应该是显而易见的。
  5. 尝试提交一个有趣的解决方案,因为这是一个受欢迎的竞赛

制胜标准

尽管该由你来决定哪个问题值得你投赞成票。这是指导方针。

  1. 基于源代码(即最加密/最模糊)的最难反转的工程输出
  2. 答案的努力和质量

dr输出一个输出输入的程序,但是很难理解正在发生的事情。尽管许多人已经讨论过这个问题(尤其是javascript),甚至还有python。我没有看到任何任意语言的这种程序的正式存储库。

EN

回答 1

Code Golf用户

回答已采纳

发布于 2016-07-02 22:32:20

Java

出于好奇,我决定编写一个简单的代码块,它输出的代码看起来并不模糊。这是生成器代码

代码语言:javascript
复制
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的字符串来说,它工作得很好。输出的程序声称是一个教程,甚至是很好的格式化!

代码语言:javascript
复制
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
    }
}
票数 2
EN
页面原文内容由Code Golf提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://codegolf.stackexchange.com/questions/84334

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档