首页
社区
课程
招聘
[求助]算法请教
2022-9-6 15:46 16847

[求助]算法请教

2022-9-6 15:46
16847

由"11111111",和"D91C",算出55E33B97.是否由可能根据55E33B97,11111111。算出D91C


using System;


public class Program

{

    public static Int32 transform(int data, int[] sec)

    {

        Int32 result = ((data % sec[0]) * sec[2]) - ((data / sec[0]) * sec[1]);

        if (result < 0)

            result += (sec[0] * sec[2]) + sec[1];

        return result;

    }


    public static string getKey(string seedTXT, string appKeyTXT)

    {

        Int32 result;


        string[] seed = { seedTXT.Substring(0, 2), seedTXT.Substring(2, 2), seedTXT.Substring(4, 2), seedTXT.Substring(6, 2) };

        string[] appKey = { appKeyTXT.Substring(0, 2), appKeyTXT.Substring(2, 2) };


        int[] sec_1 = { 0xB2, 0x3F, 0xAA };

        int[] sec_2 = { 0xB1, 0x02, 0xAB };


        Int32 res_msb = transform(Int16.Parse(appKey[0] + appKey[1], System.Globalization.NumberStyles.HexNumber), sec_1) | transform(Int16.Parse(seed[0] + seed[3], System.Globalization.NumberStyles.HexNumber), sec_2);

        Int32 res_lsb = transform(Int16.Parse(seed[1] + seed[2], System.Globalization.NumberStyles.HexNumber), sec_1) | transform(res_msb, sec_2);

        result = (res_msb << 16) | res_lsb;

        return result.ToString("X8");

    }


    public static void Main()

    {

        Console.WriteLine(getKey("11111111", "D91C"));

    }

}



[CTF入门培训]顶尖高校博士及硕士团队亲授《30小时教你玩转CTF》,视频+靶场+题目!助力进入CTF世界

收藏
点赞0
打赏
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回