CTFshow Reverse BJDCTF2020 hamburger_competition wp

发布时间 2023-11-07 13:29:01作者: Ethan(ˊ˘ˋ*)

游戏主函数在Assembly-CSharp.dll,.net写的用dnSpy打开打到主函数

else if (name == "汉堡顶" && Init.spawnCount == 5)
{
    Init.secret ^= 127;
    string str = Init.secret.ToString();
    if (ButtonSpawnFruit.Sha1(str) == "DD01903921EA24941C26A48F2CEC24E0BB0E8CC7")
    {
        this.result = "BJDCTF{" + ButtonSpawnFruit.Md5(str) + "}";
        Debug.Log(this.result);
    }
}

显然就是一个数字,它的sha1是那个然后求md5就行了,数字的很容易处理可以网上查也可以自己爆破。坑在md5函数,是在标准的md5后取了大写前20位

public static string Md5(string str)
{
    byte[] bytes = Encoding.UTF8.GetBytes(str);
    byte[] array = MD5.Create().ComputeHash(bytes);
    StringBuilder stringBuilder = new StringBuilder();
    foreach (byte b in array)
    {
        stringBuilder.Append(b.ToString("X2"));
    }
    return stringBuilder.ToString().Substring(0, 20);   //大写前20位
}

得到flag{B8C37E33DEFDE51CF91E}