I'm currently only patching this code to return true, do you guys have any idea of how I could start making a generator to make valid codes? I can't understand the logic here.
public static bool ValidateQrCode(string code)
{
if (code.Substring(0, 2) != "DC")
{
return false;
}
if (code.Length != 0x1a)
{
return false;
}
string s = code.Substring(2, 14);
byte[] buffer1 = new SHA256Managed().ComputeHash(Encoding.UTF8.GetBytes(s));
string str2 = ConvertToB36(Convert.ToInt32(buffer1[13])).PadLeft(2, '0');
string str3 = ConvertToB36(Convert.ToInt32(buffer1[10])).PadLeft(2, '0');
string str4 = ConvertToB36(Convert.ToInt32(buffer1[5])).PadLeft(2, '0');
string str5 = ConvertToB36(Convert.ToInt32(buffer1[0x11])).PadLeft(2, '0');
string str6 = ConvertToB36(Convert.ToInt32(buffer1[0x19])).PadLeft(2, '0');
return ((((code.Substring(0x10, 2) == str2) && (code.Substring(0x12, 2) == str3)) && ((code.Substring(20, 2) == str4) && (code.Substring(0x16, 2) == str5))) && (code.Substring(0x18, 2) == str6));
}
public static string ConvertToB36(int value)
{
string str = "";
while (value > 0)
{
str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[value % 0x24].ToString() + str;
value /= 0x24;
}
return str;
}