You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求识别一款从Android App反编译得到的自定义加密算法

自定义字符串加解密算法分析

反编译一款Android App(疑似混淆器遗留产物)时发现了这套字符串处理算法,它会在处理字符串时被调用,但无法归类为已知标准加密算法。以下是用Python重写的实现代码:

def decodeStr(input: str, intCode: int, charSecCode: str, mode: int) -> str:
    outString = ""
    for charIndex in range(len(input)):
        inputCurrChar = ord(input[charIndex]) & 65535
        
        if mode == 3:
            code = inputCurrChar - (intCode + charIndex) - ord(charSecCode)
        elif mode == 0:
            code = (inputCurrChar - (intCode + charIndex)) + ord(charSecCode)
        else:
            code = inputCurrChar - (intCode * 3) + ord(charSecCode)

        if code < 0:
            moduloCode = -(-code % 127)
        else:
            moduloCode = code % 127

        if moduloCode < 0:
            moduloCode += 127

        outString += chr(moduloCode)
    return outString

调用示例

decodeStr("\nx\u0006\r\u0010\n\u0004", 233, '+', 3)

该调用的输出为 samsung。

内容的提问来源于stack exchange,提问作者Christian Fiorenzo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 17:54:54