public static void Main()
Console.WriteLine(ZxSpectrumGhostBusterCode("YOURNAME", 100000));
static string ZxSpectrumGhostBusterCode(string name, int money)
if (money > 999900) return "999900 is max";
if (string.IsNullOrEmpty(name) || name.Length > 20) return "Name is invalid (Max 20 characters)";
name = name.PadRight(20);
var mon1 = uint.Parse((money / 10000).ToString(), System.Globalization.NumberStyles.HexNumber);
var mon2 = uint.Parse((money / 100 % 100).ToString(), System.Globalization.NumberStyles.HexNumber);
uint com = Math.Max(1, mon1 + mon2);
foreach (char c in name) code += (byte)c;
for (uint checksum; code-- > 0; com = checksum)
checksum = ((com << 1) + ((com >> 3 ^ com >> 7 ^ com >> 4 ^ com >> 7 ^ com >> 5 ^ com >> 7) & 1)) & 255;
var codeValue = (mon2 << 16) + (com << 8) + mon1;
return Convert.ToString(codeValue, 8).PadLeft(8, '0');