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

[求助]算法请教

2022-9-6 15:46
17763

由"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"));

    }

}



[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//