本帖最后由 3yu3 于 2022-6-24 22:53 编辑
[C#] 纯文本查看 复制代码 using System;
class Program
{
public static void Main(string[] args)
{
string text = CalculateSerialNum11938836("BFEBFBFF00090675");
Console.WriteLine("最后结果= " + text);
}
public static string CalculateSerialNum11938836(string cpucode)
{
string str = cpucode.Substring(cpucode.Length - 6, 3);
Console.WriteLine("str = " + str);
string str2 = cpucode.Substring(cpucode.Length - 3, 3);
Console.WriteLine("str2 = " + str2);
long str_toInt64 = Convert.ToInt64(str, 0x10);
Console.WriteLine("str_toInt64 = " + str_toInt64);
long str2_toInt64 = Convert.ToInt64(str2, 0x10);
Console.WriteLine("str2_toInt64 = " + str2_toInt64);
string str3 = (str_toInt64 * str2_toInt64).ToString();
Console.WriteLine("str3 = " + str3);
string str4 = str3;
Console.WriteLine("str4 = " + str4);
while (str3.Length < 6)
{
str3 = "0" + str3;
}
Console.WriteLine("str3不足6位前面补0 = " + str3);
int str4_toInt32 = Convert.ToInt32(str4);
Console.WriteLine("str4_toInt32 = " + str4_toInt32);
int num4 = str4_toInt32 * 0xb62c14;
Console.WriteLine("str4_toInt32 * 0xb62c14 = " + num4);
int num2 = (num4) + 0xb62c14;
Console.WriteLine("num2 = " + num2);
return (num2.ToString().Substring(0, 6) + str3.Substring(str3.Length - 6, 6));
}}
https://www.bejson.com/runcode/csharp/
在线运行结果:
标准输出:
str = 090
str2 = 675
str_toInt64 = 144
str2_toInt64 = 1653
str3 = 238032
str4 = 238032
str3不足6位前面补0 = 238032
str4_toInt32 = 238032
str4_toInt32 * 0xb62c14 = -1443339200
num2 = -1431400364
最后结果= -14314238032
|