吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 5237|回复: 7
上一主题 下一主题
收起左侧

[Python 转载] 【分享】兽音译者 Python实现

  [复制链接]
跳转到指定楼层
楼主
小恶芯 发表于 2022-1-5 09:55 回帖奖励

搜集的兽音译者 python实现代码在此分享,非原创

#兽音译者,一种将“呜嗷啊~”四个字符,通过特殊算法,将明文进行重新组合的加密算法。一种新的咆哮体加密算法。还可以将四个字符任意换成其它的字符,进行加密。
#另,可下载油猴插件Google selected text translator,https://greasyfork.org/en/scripts/36842-google-select-text-translator
#该插件经设置后,不仅可以划词翻译兽音密文,也可生成兽音密文

class HowlingAnimalsTranslator:

    __animalVoice="嗷呜啊~"

    def __init__(self,newAnimalVoice=None):
        self.setAnimalVoice(newAnimalVoice)

    def convert(self,txt=""):
        txt=txt.strip()
        if(txt.__len__()<1):
            return ""
        result=self.__animalVoice[3]+self.__animalVoice[1]+self.__animalVoice[0]
        offset=0
        for t in txt:
            c=ord(t)
            b=12
            while(b>=0):
                hex=(c>>b)+offset&15
                offset+=1
                result+=self.__animalVoice[int(hex>>2)]
                result+=self.__animalVoice[int(hex&3)]
                b-=4
        result+=self.__animalVoice[2]
        return result

    def deConvert(self,txt):
        txt=txt.strip()
        if(not self.identify(txt)):
            return "Incorrect format!"
        result=""
        i=3
        offset=0
        while(i<txt.__len__()-1):
            c=0
            b=i+8
            while(i<b):
                n1=self.__animalVoice.index(txt[i])
                i+=1
                n2=self.__animalVoice.index(txt[i])
                c=c<<4|((n1<<2|n2)+offset)&15
                if(offset==0):
                    offset=0x10000*0x10000-1
                else:
                    offset-=1
                i+=1
            result+=chr(c)
        return result

    def identify(self,txt):
        if(txt):
            txt=txt.strip()
            if(txt.__len__()>11):
                if(txt[0]==self.__animalVoice[3] and txt[1]==self.__animalVoice[1] and txt[2]==self.__animalVoice[0] and txt[-1]==self.__animalVoice[2] and ((txt.__len__()-4)%8)==0):
                    for t in txt:
                        if(not self.__animalVoice.__contains__(t)):
                            return False
                    return True
        return False

    def setAnimalVoice(self,voiceTxt):
        if(voiceTxt):
            voiceTxt=voiceTxt.strip()
            if(voiceTxt.__len__()==4):
                self.__animalVoice=voiceTxt
                return True
        return False

    def getAnimalVoice(self):
        return self.__animalVoice

使用方法:实例化一个HowlingAnimalsTranslator对象,调用convert()与deConvert()方法即可进行兽语的加密与解密

如图:





下载链接:
链接:https://pan.baidu.com/s/17bC0MJXhPA2FmyPGbMrWAA
提取码:52pj
--来自百度网盘超级会员V7的分享

土豪下载链接:
howlingAnimalsTranslator.rar (1.03 KB, 下载次数: 10)

免费评分

参与人数 5吾爱币 +6 热心值 +4 收起 理由
Sokwva + 1 + 1 热心回复!
苏紫方璇 + 3 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
cdwnht + 1 谢谢@Thanks!
WZJi + 1 热心回复!
461735945 + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

沙发
楼主你好萌 发表于 2022-1-5 10:35
用了你的软件,现在我家狗追着我咬
3#
水鸟 发表于 2022-1-5 10:49
4#
cdwnht 发表于 2022-1-5 11:00
?这个我喜欢 kksk 这就回家训练昨天出生的小德牧
5#
壹百八一杯 发表于 2022-1-5 12:57
感谢分享,收藏了
6#
三栖德鲁伊 发表于 2022-1-5 14:54
用什么打开啊
7#
Yh_ 发表于 2022-1-5 15:25
[Java] 纯文本查看 复制代码
package animal.language.translation;

public class Main {
    private static final String empty = "";
    private static final char[] dictionary = new char[]{'嗷', '呜', '啊', '~'};

    public static void main(String[] args) {
        String a = convert("吾爱破解");
        System.out.println(a);
        System.out.println(unConvert(a));
    }

    public static String convert(String s) {
        if (s == null || s.length() == 0) {
            return empty;
        }
        s = s.trim();
        StringBuilder sb = new StringBuilder();
        sb.append(dictionary[3]).append(dictionary[1]).append(dictionary[0]);
        int offset = 0;
        for (int i = 0; i < s.length(); i++) {
            int c = s.codePointAt(i);
            for (int b = 12; b >= 0; b -= 4) {
                int hex = (c >> b) + (offset++) & 15;
                sb.append(dictionary[(hex >> 2)]);
                sb.append(dictionary[(hex & 3)]);
            }
        }
        sb.append(dictionary[2]);
        return sb.toString();
    }

    public static String unConvert(String s) {
        s = s.trim();
        if (s.length() < 4) {
            return empty;
        }
        StringBuilder sb = new StringBuilder();

        int offset = 0;
        for (int i = 3; i < s.length() - 1; ) {
            int c = 0;
            for (int b = i + 8; i < b; i++) {
                int aa = indexOf(s.charAt(i++));
                int bb = indexOf(s.charAt(i));
                c = c << 4 | ((aa << 2 | bb) + offset) & 0xf;
                offset = (offset == 0 ? -1 : offset - 1);
            }
            System.out.println(c);
            sb.append((char) c);
        }
        return sb.toString();
    }

    private static int indexOf(char c) {
        for (int i = 0; i < dictionary.length; i++) {
            if (c == dictionary[i]) {
                return i;
            }
        }
        assert false;
        return 0;
    }
}
8#
 楼主| 小恶芯 发表于 2022-1-5 20:45 |楼主

我这里直接用python自带的idle shell运行的,具体运行方法如图
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-26 00:05

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表