Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
713 lines (654 sloc) 44.1 KB
QCRACK reimplemented in C by Eric Faehnrich
One challenge string I found with a result different
than QCRACK is Q76820422412, it's valid and for the
same game, but gives a different serial number.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
These are TODO mem blocks, will do later
I got enough for testing for the time being
(and besides, I think the Quake shareware CD
only generates challenge strings for 'quake')
These being mem dumps, they are bytes in order. Note that the actual stored
and used values in the arrays are two-byte values, so are in little-endian.
So for instance the first value of quake3, it's first two mem dump bytes
has f704, but the first 16-bit value in the array is 0x04f7
uint16_t DOOM2[] = {
0x04ec, 0x18ea, 0x0245, 0x0657, 0x0923, 0x0d01, 0x04de, 0x2059, 0x0099, 0x00a0,
0x11a6, 0x1a6e, 0x09b8, 0x0c20, 0x125e, 0x0163, 0x014c, 0x0a21, 0x1ab8, 0x157e,
0x0509, 0x0363, 0x11c2, 0x1606, 0x0027, 0x120f, 0x10d8, 0x202e, 0x0b10, 0x2187,
0x0578, 0x08fa, 0x19ad, 0x1c5c, 0x05ba, 0x125c, 0x1813, 0x17b8, 0x0240, 0x1462,
0x1c4f, 0x19c2, 0x1b9d, 0x0963, 0x1a24, 0x0453, 0x21ed, 0x0db5, 0x0e7f, 0x0bb6,
0x20aa, 0x0184, 0x0795, 0x04da, 0x02c2, 0x08e9, 0x2136, 0x060e, 0x07d4, 0x0efd,
0x0002, 0x09e5, 0x0cc5, 0x0cc2, 0x0d85, 0x04d9, 0x19b2, 0x163c, 0x0de2, 0x21dd,
0x16a2, 0x2003, 0x20a3, 0x1d9c, 0x21e6, 0x1877, 0x218e, 0x0306, 0x1791, 0x14c9,
0x0fba, 0x053b, 0x0e19, 0x0e23, 0x11cd, 0x16b5, 0x0e41, 0x066b, 0x10ef, 0x1999,
0x0f25, 0x202f, 0x1b5d, 0x0cd5, 0x1af5, 0x01ae, 0x0d91, 0x1eef, 0x0199, 0x123a,
0x0ab3, 0x1680, 0x017a, 0x0a78, 0x16f1, 0x0146, 0x0bf8, 0x1132, 0x02ea, 0x051d,
0x106b, 0x0d27, 0x150d, 0x13fc, 0x06bf, 0x1239, 0x0e65, 0x0fd4, 0x0b93, 0x0eb1,
0x00a5, 0x1dab, 0x1833, 0x161f, 0x16fb, 0x1a1b, 0x1ec3, 0x11a1, 0x171f, 0x1682,
0x1662, 0x1c69, 0x0448, 0x181f, 0x0b62, 0x200e, 0x1073, 0x1c8b, 0x1324, 0x1248,
0x0069, 0x1f8e, 0x1030, 0x1785, 0x00a4, 0x08f3, 0x1d53, 0x20bd, 0x1b88, 0x1274,
0x122d, 0x09f0, 0x0840, 0x06ae, 0x0274, 0x046e, 0x02c6, 0x06fc, 0x00cd, 0x1434,
0x1b3e, 0x121b, 0x0c1b, 0x2121, 0x1de9, 0x1057, 0x1488, 0x18e6, 0x0735, 0x1a2e,
0x222a, 0x0615, 0x2047, 0x19bf, 0x0081, 0x13e5, 0x00c4, 0x0901, 0x145a, 0x0bde,
0x0836, 0x1d8a, 0x1b2a, 0x196e, 0x0b34, 0x12c7, 0x0756, 0x1fb8, 0x0655, 0x1cf4,
0x22ce, 0x0572, 0x08e7, 0x16ba, 0x1817, 0x21d1, 0x0a08, 0x04be, 0x211c, 0x22a8,
0x10b2, 0x08b4, 0x157e, 0x144d, 0x1c7f, 0x2149, 0x05e4, 0x1275, 0x0180, 0x0e50,
0x1897, 0x0057, 0x2167, 0x0799, 0x0520, 0x1bd4, 0x1871, 0x0376, 0x09bc, 0x151e,
0x1c3f, 0x020c, 0x12dc, 0x1a4c, 0x1b0b, 0x0ab6, 0x12eb, 0x06e6, 0x0747, 0x129e,
0x2182, 0x1d22, 0x06fc, 0x101d, 0x16aa, 0x1ea9, 0x004b, 0x06fc, 0x0a27, 0x037d,
0x1ea0, 0x2134, 0x0df4, 0x0d77, 0x198d, 0x1aaf, 0x1977, 0x055f, 0x0c93, 0x0315,
0x184e, 0x0fd7, 0x01a6, 0x1108
uint16_t ULTDM95[] = {
0x04ee, 0x1854, 0x0275, 0x0602, 0x09d1, 0x0da2, 0x04bd, 0x2096, 0x00d6, 0x0023,
0x11e7, 0x1a52, 0x0998, 0x0c85, 0x12dd, 0x01b4, 0x0169, 0x0a89, 0x1a27, 0x15ae,
0x05fe, 0x0380, 0x119c, 0x1625, 0x0013, 0x12df, 0x103a, 0x201c, 0x0b30, 0x2148,
0x05c7, 0x088a, 0x19bf, 0x1c05, 0x052a, 0x1221, 0x18af, 0x1766, 0x025e, 0x1479,
0x1cd1, 0x1972, 0x1b53, 0x0901, 0x1a2d, 0x0425, 0x2130, 0x0d38, 0x0eee, 0x0b87,
0x2084, 0x01b1, 0x0797, 0x04d5, 0x0272, 0x0802, 0x21a4, 0x068b, 0x0779, 0x0e5f,
0x00d8, 0x09f2, 0x0c68, 0x0ceb, 0x0d39, 0x0496, 0x1972, 0x1605, 0x0da7, 0x2198,
0x16e9, 0x206a, 0x204d, 0x1d01, 0x2174, 0x186d, 0x2185, 0x03e3, 0x17a3, 0x1487,
0x0f28, 0x050a, 0x0e9e, 0x0ec2, 0x1176, 0x1610, 0x0ebe, 0x06d5, 0x10e8, 0x1964,
0x0f1e, 0x2064, 0x1bd7, 0x0cd5, 0x1a4b, 0x019f, 0x0d3f, 0x1e52, 0x0147, 0x126b,
0x0a5c, 0x16ac, 0x014b, 0x0a9c, 0x1619, 0x01c1, 0x0b7b, 0x1187, 0x026e, 0x0580,
0x10f0, 0x0d79, 0x1585, 0x130d, 0x065a, 0x12ba, 0x0e24, 0x0f5d, 0x0b1d, 0x0e93,
0x007f, 0x1d58, 0x1893, 0x16ac, 0x16ad, 0x1a49, 0x1ed2, 0x11ad, 0x172a, 0x16d4,
0x168d, 0x1c10, 0x0448, 0x1827, 0x0b67, 0x2011, 0x10c2, 0x1c58, 0x13f6, 0x1209,
0x000f, 0x1f0a, 0x1044, 0x17ae, 0x007f, 0x08b6, 0x1d04, 0x20ad, 0x1b3a, 0x121c,
0x124a, 0x0941, 0x08e7, 0x06b8, 0x0275, 0x04db, 0x02d9, 0x06ac, 0x0032, 0x14ea,
0x1b16, 0x124a, 0x0c2c, 0x218e, 0x1dff, 0x1063, 0x14bb, 0x1899, 0x07d4, 0x1ad2,
0x2240, 0x061b, 0x204d, 0x19eb, 0x00c3, 0x13b9, 0x008f, 0x09d6, 0x147e, 0x0b0e,
0x087c, 0x1d0e, 0x1b86, 0x1969, 0x0b37, 0x12ed, 0x07aa, 0x1fd5, 0x060d, 0x1ce5,
0x226e, 0x0515, 0x089b, 0x16e5, 0x1881, 0x21ef, 0x0ae0, 0x040b, 0x2177, 0x22bf,
0x1086, 0x082e, 0x1501, 0x14d0, 0x1c82, 0x2176, 0x0591, 0x12f5, 0x01b8, 0x0ef9,
0x181a, 0x005a, 0x212d, 0x07c8, 0x05e0, 0x1b38, 0x18d2, 0x0324, 0x0935, 0x15b6,
0x1cf0, 0x023e, 0x1263, 0x1a1d, 0x1b1c, 0x0ac9, 0x12a2, 0x061b, 0x0777, 0x12ae,
0x21aa, 0x1def, 0x0608, 0x107c, 0x16d4, 0x1e02, 0x0015, 0x066d, 0x0a24, 0x0378,
0x1e5b, 0x219a, 0x0d6c, 0x0dd9, 0x1921, 0x1a07, 0x197a, 0x0544, 0x0cc1, 0x03c2,
0x1840, 0x0f33, 0x018a, 0x11f6,
uint16_t MASTER[] = {
0x04ad, 0x1855, 0x028d, 0x06dd, 0x091e, 0x0d1e, 0x0453, 0x20ea, 0x0061, 0x00c7,
0x1108, 0x1a75, 0x0974, 0x0c62, 0x1215, 0x01e0, 0x0157, 0x0a50, 0x1a49, 0x15bc,
0x057b, 0x03bc, 0x1170, 0x1667, 0x0087, 0x127d, 0x10c4, 0x209e, 0x0b12, 0x21d6,
0x056c, 0x0822, 0x1984, 0x1c8e, 0x0599, 0x129b, 0x18ab, 0x176f, 0x0273, 0x141d,
0x1c53, 0x1947, 0x1b5b, 0x09dc, 0x1a93, 0x041e, 0x21ff, 0x0d68, 0x0ea4, 0x0bb2,
0x20b5, 0x01b9, 0x07f3, 0x04d1, 0x028e, 0x0852, 0x2193, 0x0689, 0x0772, 0x0e76,
0x00eb, 0x0924, 0x0c77, 0x0cb1, 0x0db0, 0x044f, 0x1995, 0x16f8, 0x0dcd, 0x2147,
0x16dc, 0x2006, 0x2067, 0x1d1d, 0x2189, 0x1856, 0x219d, 0x03fa, 0x1788, 0x1487,
0x0f65, 0x053f, 0x0e27, 0x0e36, 0x117e, 0x16c2, 0x0ea7, 0x0650, 0x1011, 0x1944,
0x0fc5, 0x20b6, 0x1be0, 0x0c27, 0x1a85, 0x0122, 0x0d41, 0x1eb9, 0x010e, 0x12d7,
0x0a9c, 0x16a8, 0x011a, 0x0a89, 0x1672, 0x0153, 0x0b02, 0x1128, 0x02f0, 0x05ad,
0x10de, 0x0d4f, 0x15b5, 0x1326, 0x06ed, 0x12a0, 0x0ee2, 0x0f88, 0x0bfe, 0x0e17,
0x0096, 0x1df9, 0x1874, 0x1652, 0x169c, 0x1a27, 0x1e83, 0x1179, 0x17fb, 0x163b,
0x163c, 0x1cfb, 0x04d0, 0x18d7, 0x0ba7, 0x20f7, 0x1005, 0x1cc8, 0x13a0, 0x12bc,
0x00df, 0x1fb0, 0x1098, 0x1719, 0x0019, 0x0837, 0x1db0, 0x2065, 0x1b02, 0x1252,
0x1206, 0x098a, 0x08aa, 0x0648, 0x0249, 0x044e, 0x021e, 0x0666, 0x0055, 0x14b9,
0x1bb8, 0x12ef, 0x0c6a, 0x21df, 0x1dab, 0x1011, 0x14f7, 0x188f, 0x07fc, 0x1a7a,
0x22e8, 0x069a, 0x20df, 0x1958, 0x001d, 0x13aa, 0x00d1, 0x0929, 0x14b5, 0x0b5b,
0x08fa, 0x1d7c, 0x1b2c, 0x190e, 0x0b2c, 0x12ac, 0x077b, 0x1f8f, 0x0664, 0x1cbf,
0x2228, 0x0522, 0x0841, 0x1679, 0x180a, 0x2137, 0x0aba, 0x0492, 0x2170, 0x227b,
0x109a, 0x083f, 0x155d, 0x148f, 0x1c66, 0x2115, 0x05c6, 0x12c9, 0x01e2, 0x0e9b,
0x188b, 0x0091, 0x21ac, 0x0777, 0x0520, 0x1bbe, 0x18d6, 0x0373, 0x09cc, 0x151e,
0x1c51, 0x0238, 0x127d, 0x1ad5, 0x1b1d, 0x0aa9, 0x12f3, 0x0639, 0x0777, 0x1292,
0x21a5, 0x1de6, 0x060c, 0x10b5, 0x168b, 0x1e3f, 0x008f, 0x06a6, 0x0a5e, 0x0321,
0x1e42, 0x2126, 0x0d0d, 0x0da3, 0x19a5, 0x1a6b, 0x190d, 0x0577, 0x0c66, 0x0316,
0x181a, 0x0fef, 0x01f6, 0x1104,
uint16_t HEXEN[] = {
0x04dd, 0x18e2, 0x02a7, 0x06d4, 0x091a, 0x0d3a, 0x042e, 0x20a4, 0x0075, 0x00d5,
0x113e, 0x1a7d, 0x098c, 0x0c27, 0x1215, 0x01d5, 0x0142, 0x0a42, 0x1ac8, 0x1579,
0x05c2, 0x0301, 0x117d, 0x16b1, 0x0057, 0x12d6, 0x10a5, 0x2080, 0x0bad, 0x21f4,
0x0518, 0x0834, 0x1986, 0x1cdd, 0x057b, 0x127e, 0x181c, 0x17b8, 0x024d, 0x141b,
0x1cf2, 0x194c, 0x1b7d, 0x0950, 0x1a44, 0x0405, 0x211b, 0x0d86, 0x0e37, 0x0bdd,
0x206f, 0x0195, 0x0732, 0x049e, 0x0283, 0x0858, 0x2177, 0x06ac, 0x0743, 0x0e3a,
0x0090, 0x091f, 0x0c45, 0x0c31, 0x0d89, 0x04fa, 0x19ca, 0x16a7, 0x0d92, 0x21ea,
0x16a4, 0x201f, 0x20f5, 0x1d51, 0x21e2, 0x18bd, 0x21d8, 0x0352, 0x1725, 0x1442,
0x0ff7, 0x057b, 0x0e7e, 0x0ee6, 0x1144, 0x164d, 0x0ecd, 0x069d, 0x10b1, 0x194e,
0x0f95, 0x20f8, 0x1b2c, 0x0c2f, 0x1aa5, 0x01d7, 0x0dc8, 0x1e4b, 0x01b4, 0x12d3,
0x0a3c, 0x1608, 0x01cb, 0x0ab9, 0x169d, 0x011a, 0x0b68, 0x115c, 0x0228, 0x05dc,
0x105c, 0x0de4, 0x15ab, 0x13a6, 0x0613, 0x121d, 0x0eb4, 0x0f47, 0x0bc2, 0x0edf,
0x00cb, 0x1d55, 0x18cf, 0x162c, 0x16f2, 0x1ac8, 0x1ef6, 0x1191, 0x170d, 0x1673,
0x164b, 0x1c43, 0x04d3, 0x18fc, 0x0b9a, 0x20bd, 0x1043, 0x1ce3, 0x13fe, 0x1255,
0x00c0, 0x1f36, 0x101e, 0x175e, 0x0092, 0x08f8, 0x1d97, 0x20f1, 0x1b52, 0x1261,
0x12da, 0x0992, 0x08ad, 0x067e, 0x0210, 0x04ea, 0x0247, 0x06a3, 0x00e9, 0x1483,
0x1b2a, 0x12ae, 0x0cdd, 0x212f, 0x1d74, 0x10e3, 0x1444, 0x18b3, 0x0799, 0x1a52,
0x22f5, 0x06e9, 0x2062, 0x1941, 0x00eb, 0x13a3, 0x00ab, 0x097a, 0x146d, 0x0b5c,
0x0885, 0x1d64, 0x1b46, 0x19e9, 0x0b93, 0x1227, 0x0792, 0x1f35, 0x06cd, 0x1c30,
0x220c, 0x0518, 0x0829, 0x16ae, 0x18aa, 0x2134, 0x0a4a, 0x0462, 0x2148, 0x226c,
0x103e, 0x0830, 0x1558, 0x146e, 0x1cff, 0x21e2, 0x050d, 0x129a, 0x01b1, 0x0ebc,
0x18db, 0x0094, 0x2132, 0x0706, 0x05e7, 0x1b36, 0x18c0, 0x03f2, 0x0945, 0x15fe,
0x1c51, 0x026a, 0x1233, 0x1af4, 0x1b82, 0x0ad7, 0x1203, 0x060a, 0x0764, 0x124f,
0x2139, 0x1dd4, 0x0607, 0x10b2, 0x1658, 0x1e2a, 0x0074, 0x06d2, 0x0ab2, 0x03c2,
0x1eef, 0x21ab, 0x0d21, 0x0d90, 0x199c, 0x1a8d, 0x19bd, 0x0584, 0x0cc8, 0x0375,
0x1810, 0x0f29, 0x01de, 0x11b0,
uint16_t HERETIC[] = {
0x0455, 0x18d9, 0x024e, 0x06a0, 0x0983, 0x0d9a, 0x043e, 0x2089, 0x00dd, 0x00a3,
0x1151, 0x1ad7, 0x0901, 0x0c7a, 0x1258, 0x01f2, 0x012d, 0x0ab6, 0x1a66, 0x1521,
0x0548, 0x0359, 0x11ff, 0x16ce, 0x00fb, 0x1255, 0x1094, 0x200f, 0x0bbb, 0x21ec,
0x05a1, 0x08b4, 0x19df, 0x1cb9, 0x05e5, 0x12c9, 0x1871, 0x1707, 0x0225, 0x14ea,
0x1c0f, 0x197a, 0x1b65, 0x0918, 0x1a05, 0x04da, 0x21bc, 0x0d5b, 0x0e65, 0x0bcc,
0x20f9, 0x0172, 0x07ba, 0x04cb, 0x0295, 0x0839, 0x219c, 0x0646, 0x0749, 0x0e20,
0x0088, 0x0971, 0x0c89, 0x0ce6, 0x0d56, 0x0426, 0x1993, 0x163c, 0x0d5a, 0x21cc,
0x16e4, 0x202e, 0x2085, 0x1dd3, 0x2144, 0x186e, 0x21cc, 0x039a, 0x174e, 0x143f,
0x0f66, 0x0533, 0x0eb1, 0x0e47, 0x1123, 0x1681, 0x0e8b, 0x06f0, 0x10b2, 0x1947,
0x0f1e, 0x20be, 0x1bda, 0x0c8b, 0x1a84, 0x0132, 0x0d44, 0x1e74, 0x01cd, 0x12e0,
0x0af8, 0x16be, 0x01db, 0x0af5, 0x16f5, 0x016d, 0x0b49, 0x11c4, 0x02ee, 0x0592,
0x104c, 0x0d4d, 0x1544, 0x1397, 0x062f, 0x12d2, 0x0eea, 0x0f54, 0x0b01, 0x0e16,
0x00fa, 0x1d60, 0x18c0, 0x16a7, 0x164b, 0x1a9b, 0x1e79, 0x114b, 0x17c3, 0x165d,
0x16d0, 0x1c01, 0x04cb, 0x18e0, 0x0b4e, 0x2009, 0x107a, 0x1cd5, 0x1367, 0x120f,
0x00af, 0x1fd3, 0x109b, 0x1734, 0x0024, 0x08f5, 0x1da3, 0x202b, 0x1ba8, 0x12a3,
0x1279, 0x09ef, 0x084a, 0x066c, 0x0232, 0x04d2, 0x0239, 0x061a, 0x00e8, 0x140d,
0x1bb5, 0x12c8, 0x0c27, 0x21bc, 0x1db1, 0x10e7, 0x14fc, 0x1842, 0x0760, 0x1a96,
0x22d6, 0x0668, 0x200e, 0x19ed, 0x00e8, 0x133d, 0x0056, 0x09f6, 0x14ad, 0x0bfe,
0x0882, 0x1d1c, 0x1b9c, 0x19bb, 0x0b04, 0x1231, 0x0735, 0x1faa, 0x06e7, 0x1c21,
0x225c, 0x05da, 0x0824, 0x161d, 0x1801, 0x21c5, 0x0a07, 0x04d0, 0x2111, 0x220a,
0x10ef, 0x083b, 0x15f4, 0x144c, 0x1ce8, 0x2133, 0x05bb, 0x120b, 0x0156, 0x0ea8,
0x1806, 0x005d, 0x2190, 0x07e5, 0x05e6, 0x1b58, 0x186f, 0x0372, 0x09ec, 0x15e1,
0x1cdc, 0x028c, 0x1210, 0x1a1d, 0x1b3e, 0x0af9, 0x129d, 0x0632, 0x07f4, 0x12a7,
0x212c, 0x1dc1, 0x064e, 0x1095, 0x16ae, 0x1ed4, 0x00a9, 0x06b1, 0x0a43, 0x03c6,
0x1e6a, 0x21a4, 0x0d7a, 0x0d81, 0x192c, 0x1a1b, 0x1925, 0x0535, 0x0cc7, 0x032e,
0x18f4, 0x0f38, 0x0117, 0x1156,
uint16_t WOLF3D[] = {
0x0460, 0x18bd, 0x02d7, 0x06ad, 0x093c, 0x0d14, 0x0425, 0x20cc, 0x0097, 0x0033,
0x11d0, 0x1aa4, 0x0900, 0x0c5c, 0x1261, 0x0137, 0x016c, 0x0a1f, 0x1a3c, 0x15dc,
0x0563, 0x0330, 0x1149, 0x163d, 0x00f5, 0x1266, 0x106b, 0x20aa, 0x0be5, 0x21bd,
0x0532, 0x086c, 0x19f1, 0x1c7e, 0x05ca, 0x1285, 0x1828, 0x17dd, 0x0246, 0x1417,
0x1c30, 0x194d, 0x1b6f, 0x0942, 0x1a58, 0x04d8, 0x211a, 0x0d01, 0x0e6b, 0x0b5d,
0x2050, 0x01ca, 0x07db, 0x049b, 0x0247, 0x08a3, 0x21c9, 0x06d6, 0x079f, 0x0e01,
0x003a, 0x0992, 0x0c00, 0x0cd5, 0x0d0d, 0x041e, 0x19dc, 0x1610, 0x0d54, 0x21b4,
0x167e, 0x2000, 0x2068, 0x1d40, 0x2129, 0x18c6, 0x21b8, 0x034b, 0x17a3, 0x14f6,
0x0f9a, 0x0517, 0x0eb2, 0x0e2e, 0x11d8, 0x16a6, 0x0e19, 0x069a, 0x1066, 0x1929,
0x0f7a, 0x204f, 0x1ba7, 0x0cf4, 0x1aa6, 0x0140, 0x0d77, 0x1e8c, 0x01f6, 0x12d6,
0x0a1f, 0x1620, 0x01fc, 0x0ad4, 0x16ef, 0x012c, 0x0bfa, 0x11b4, 0x024f, 0x058c,
0x108a, 0x0d75, 0x1563, 0x1349, 0x06a2, 0x1250, 0x0e24, 0x0fc7, 0x0b0c, 0x0e24,
0x0097, 0x1dc6, 0x18f1, 0x1657, 0x161b, 0x1a61, 0x1e4b, 0x11fa, 0x17dd, 0x164a,
0x1668, 0x1cd6, 0x0446, 0x180f, 0x0b7c, 0x20e5, 0x10d7, 0x1c33, 0x135f, 0x123f,
0x00d7, 0x1f83, 0x10d9, 0x17d6, 0x0085, 0x080b, 0x1da2, 0x2006, 0x1bb9, 0x128b,
0x127a, 0x0917, 0x082e, 0x06b5, 0x02da, 0x04d4, 0x0253, 0x06a1, 0x000e, 0x14f7,
0x1b72, 0x12e5, 0x0cab, 0x21da, 0x1dfc, 0x10a7, 0x14c9, 0x187c, 0x0786, 0x1af5,
0x224a, 0x0626, 0x20b6, 0x1927, 0x00cf, 0x1325, 0x00ab, 0x095e, 0x146c, 0x0bac,
0x08ca, 0x1dcc, 0x1b0e, 0x19a0, 0x0b16, 0x12f9, 0x07dc, 0x1f30, 0x0638, 0x1cfa,
0x22d2, 0x056d, 0x0871, 0x16dd, 0x182c, 0x21f5, 0x0a74, 0x04a9, 0x21e2, 0x22ca,
0x1075, 0x082d, 0x152f, 0x1415, 0x1c67, 0x2105, 0x054e, 0x123f, 0x019c, 0x0ed6,
0x187b, 0x00c9, 0x21f5, 0x075d, 0x05b4, 0x1b52, 0x1803, 0x0347, 0x09a8, 0x15d2,
0x1cd8, 0x0221, 0x1230, 0x1a1f, 0x1b4e, 0x0ae4, 0x1219, 0x0644, 0x07db, 0x12b2,
0x210d, 0x1ddd, 0x06cd, 0x1074, 0x1652, 0x1e8c, 0x0018, 0x0637, 0x0a81, 0x03ab,
0x1e0d, 0x2131, 0x0df7, 0x0da6, 0x19cd, 0x1a68, 0x19d5, 0x05a9, 0x0ce2, 0x03e3,
0x1853, 0x0fef, 0x01d5, 0x1161,
uint16_t HERETC13[] = {
0x04a1, 0x180e, 0x02e0, 0x0610, 0x0973, 0x0db6, 0x04c7, 0x20da, 0x00ea, 0x0055,
0x11a6, 0x1af9, 0x0948, 0x0c1f, 0x12b3, 0x01a3, 0x0145, 0x0a32, 0x1abd, 0x1547,
0x05b1, 0x037c, 0x1173, 0x1623, 0x00e6, 0x1267, 0x105a, 0x2068, 0x0bcf, 0x2182,
0x0513, 0x086f, 0x19f9, 0x1c07, 0x050c, 0x12ed, 0x18ad, 0x17df, 0x0218, 0x147b,
0x1cd9, 0x1962, 0x1b62, 0x0998, 0x1af0, 0x04ff, 0x2196, 0x0d45, 0x0e15, 0x0b39,
0x204c, 0x01d5, 0x079b, 0x0481, 0x0235, 0x08d9, 0x217e, 0x0630, 0x07b7, 0x0ee0,
0x0086, 0x09de, 0x0c4a, 0x0c90, 0x0db5, 0x042c, 0x19cc, 0x16c5, 0x0d14, 0x215e,
0x16aa, 0x2034, 0x207b, 0x1dce, 0x2125, 0x18ca, 0x2173, 0x0329, 0x1796, 0x14e8,
0x0f29, 0x0576, 0x0e86, 0x0ec9, 0x112d, 0x160f, 0x0e30, 0x06a4, 0x1076, 0x19de,
0x0fcb, 0x205d, 0x1b28, 0x0c14, 0x1a51, 0x01cd, 0x0d6e, 0x1e6b, 0x01dd, 0x1214,
0x0ae8, 0x16ff, 0x012e, 0x0ac9, 0x1615, 0x0153, 0x0b8d, 0x1148, 0x025e, 0x05bc,
0x100e, 0x0dff, 0x156b, 0x1303, 0x06fb, 0x1228, 0x0e29, 0x0f16, 0x0b0e, 0x0e71,
0x0089, 0x1d4b, 0x1864, 0x1634, 0x1603, 0x1acc, 0x1eb3, 0x11dd, 0x1735, 0x168c,
0x16c7, 0x1cfb, 0x04dc, 0x185f, 0x0bb0, 0x209b, 0x10cd, 0x1c25, 0x1352, 0x12f1,
0x0049, 0x1fb6, 0x1085, 0x17c8, 0x008a, 0x0823, 0x1db7, 0x20c2, 0x1b20, 0x128c,
0x12c0, 0x0928, 0x083d, 0x067c, 0x0240, 0x049f, 0x02a4, 0x06a3, 0x00fa, 0x14ce,
0x1ba9, 0x12c5, 0x0c98, 0x2145, 0x1de6, 0x1053, 0x148d, 0x1833, 0x076d, 0x1a8b,
0x22d1, 0x0670, 0x20b4, 0x192d, 0x0040, 0x1310, 0x0044, 0x09d1, 0x141d, 0x0b5f,
0x08c2, 0x1dbe, 0x1b53, 0x19bf, 0x0ba6, 0x121a, 0x0758, 0x1fe4, 0x064b, 0x1cd2,
0x2261, 0x0539, 0x0806, 0x1675, 0x1866, 0x2150, 0x0ac1, 0x0479, 0x2109, 0x2236,
0x1065, 0x080b, 0x1537, 0x1409, 0x1cf5, 0x21d5, 0x05d1, 0x125a, 0x01e0, 0x0ea2,
0x18d2, 0x00c2, 0x2152, 0x077f, 0x0549, 0x1b78, 0x1844, 0x0394, 0x0957, 0x15d8,
0x1cc5, 0x021b, 0x12c8, 0x1a10, 0x1b52, 0x0a23, 0x1263, 0x06ec, 0x0719, 0x124e,
0x2101, 0x1d8e, 0x064f, 0x105a, 0x1685, 0x1e05, 0x0052, 0x06c5, 0x0a8f, 0x0337,
0x1edf, 0x2109, 0x0da0, 0x0d39, 0x1914, 0x1adf, 0x19bc, 0x0528, 0x0c04, 0x03db,
0x18c7, 0x0f8a, 0x01e9, 0x1199,
uint16_t DEATH[] = {
0x0437, 0x18fa, 0x0262, 0x0610, 0x0917, 0x0d6a, 0x0452, 0x2088, 0x0037, 0x002e,
0x11a0, 0x1a4e, 0x0929, 0x0c55, 0x12a1, 0x0163, 0x0180, 0x0ac6, 0x1a24, 0x1583,
0x050e, 0x03f0, 0x11d1, 0x1672, 0x0037, 0x126b, 0x10c3, 0x20a5, 0x0b60, 0x2199,
0x05b6, 0x089e, 0x1979, 0x1c4b, 0x05f5, 0x1268, 0x184e, 0x17f6, 0x02f5, 0x1404,
0x1ca7, 0x1948, 0x1b36, 0x09bc, 0x1ab6, 0x0408, 0x21aa, 0x0dbf, 0x0ecb, 0x0b6b,
0x2091, 0x01b3, 0x07b7, 0x04a0, 0x026a, 0x08e9, 0x217d, 0x0645, 0x0744, 0x0e86,
0x005f, 0x09c5, 0x0c3e, 0x0cf5, 0x0d8d, 0x0414, 0x1975, 0x16eb, 0x0d18, 0x21c9,
0x1625, 0x20af, 0x20fd, 0x1d5b, 0x219a, 0x18c8, 0x212b, 0x037c, 0x175a, 0x147b,
0x0f29, 0x052f, 0x0e13, 0x0eb7, 0x117a, 0x16b0, 0x0e1f, 0x0632, 0x109f, 0x1979,
0x0f4c, 0x2085, 0x1bf9, 0x0cbe, 0x1a35, 0x0130, 0x0db3, 0x1e0c, 0x01dc, 0x12e4,
0x0ae7, 0x168e, 0x01c9, 0x0a8c, 0x1628, 0x0150, 0x0b58, 0x1122, 0x028c, 0x0588,
0x105c, 0x0d8d, 0x1540, 0x1376, 0x0625, 0x12d7, 0x0e7e, 0x0f4a, 0x0ba5, 0x0eae,
0x0096, 0x1d42, 0x1849, 0x1662, 0x167a, 0x1a9c, 0x1e14, 0x11f7, 0x171f, 0x16db,
0x16c3, 0x1cd5, 0x047d, 0x1880, 0x0beb, 0x203c, 0x108f, 0x1cfe, 0x133f, 0x1232,
0x00c2, 0x1fa7, 0x1047, 0x17a1, 0x0037, 0x088f, 0x1d5b, 0x20f6, 0x1b96, 0x123d,
0x125c, 0x09a4, 0x08ff, 0x061b, 0x02d9, 0x040d, 0x02c4, 0x0618, 0x0030, 0x1487,
0x1b17, 0x12ba, 0x0c3a, 0x2104, 0x1d31, 0x10e6, 0x1434, 0x1867, 0x078c, 0x1a18,
0x225d, 0x06e7, 0x20bf, 0x192c, 0x0053, 0x139a, 0x00e1, 0x0971, 0x14d2, 0x0b50,
0x0810, 0x1d60, 0x1b23, 0x1959, 0x0bbe, 0x1294, 0x07b5, 0x1f6e, 0x0647, 0x1c31,
0x228d, 0x0556, 0x0838, 0x161c, 0x1878, 0x21f6, 0x0a40, 0x04b9, 0x2137, 0x22ac,
0x1000, 0x0899, 0x15ac, 0x14a6, 0x1c1e, 0x21e5, 0x05e3, 0x122e, 0x01de, 0x0e6b,
0x1853, 0x006a, 0x21e1, 0x07bc, 0x0516, 0x1b59, 0x1834, 0x0324, 0x0947, 0x153d,
0x1ca0, 0x025d, 0x1223, 0x1ab8, 0x1b47, 0x0aba, 0x1289, 0x06b5, 0x07cd, 0x123f,
0x215b, 0x1d66, 0x06aa, 0x10c1, 0x1629, 0x1ee4, 0x000c, 0x06bc, 0x0a76, 0x0361,
0x1efd, 0x2145, 0x0d06, 0x0d2e, 0x1939, 0x1a2b, 0x197a, 0x0535, 0x0c58, 0x0338,
0x1810, 0x0fe3, 0x0179, 0x11b7,
uint16_t HEXEN11[] = {
0x0440, 0x18a4, 0x0228, 0x0678, 0x094b, 0x0d82, 0x04b3, 0x2073, 0x0039, 0x008d,
0x1174, 0x1a4f, 0x09eb, 0x0c9c, 0x121e, 0x01a8, 0x01e0, 0x0a1f, 0x1ae8, 0x1569,
0x0530, 0x0396, 0x11f4, 0x1661, 0x00e5, 0x1283, 0x10f0, 0x20ea, 0x0bd7, 0x212c,
0x052e, 0x08be, 0x19e6, 0x1c0b, 0x05c9, 0x121d, 0x18b8, 0x178f, 0x023d, 0x146a,
0x1c03, 0x197b, 0x1b10, 0x09df, 0x1a0f, 0x0466, 0x2101, 0x0d84, 0x0e82, 0x0b38,
0x2035, 0x0125, 0x07da, 0x0481, 0x0200, 0x08d1, 0x21fb, 0x069a, 0x0723, 0x0eb5,
0x0068, 0x09d4, 0x0c70, 0x0c96, 0x0d18, 0x044d, 0x19ce, 0x166c, 0x0d8f, 0x21f6,
0x1634, 0x20b1, 0x2016, 0x1d71, 0x21c5, 0x188d, 0x21ab, 0x03eb, 0x178f, 0x1441,
0x0f01, 0x0509, 0x0e96, 0x0e0c, 0x11e7, 0x16b9, 0x0e1c, 0x0673, 0x1019, 0x19da,
0x0f01, 0x20aa, 0x1b6b, 0x0c3e, 0x1ae1, 0x0139, 0x0d4a, 0x1e6a, 0x0163, 0x1279,
0x0a53, 0x1607, 0x01d6, 0x0af4, 0x1607, 0x015f, 0x0b1b, 0x11a9, 0x0290, 0x05de,
0x10d1, 0x0d0c, 0x153c, 0x13d0, 0x0623, 0x12c7, 0x0e19, 0x0f5d, 0x0bdf, 0x0ef2,
0x0087, 0x1d7c, 0x18b9, 0x16e7, 0x1699, 0x1a6c, 0x1e36, 0x11b7, 0x17b1, 0x16ab,
0x16b5, 0x1c6f, 0x04a6, 0x18ba, 0x0b95, 0x2071, 0x1061, 0x1c79, 0x1313, 0x1234,
0x0013, 0x1f09, 0x1066, 0x17dd, 0x00c2, 0x08bb, 0x1d37, 0x2074, 0x1bcb, 0x12a2,
0x12b8, 0x09a5, 0x08c2, 0x0697, 0x0255, 0x04ef, 0x0212, 0x0693, 0x007e, 0x146a,
0x1b98, 0x1211, 0x0c2f, 0x21d5, 0x1d10, 0x10a7, 0x14f4, 0x18c5, 0x071e, 0x1a84,
0x22b4, 0x060d, 0x2008, 0x19cb, 0x00ad, 0x130f, 0x003a, 0x0924, 0x146d, 0x0bba,
0x0869, 0x1d21, 0x1b5f, 0x194c, 0x0bd8, 0x12ee, 0x077a, 0x1f2d, 0x06a3, 0x1c98,
0x22a9, 0x05c5, 0x08ad, 0x16fc, 0x1857, 0x212d, 0x0a0b, 0x041c, 0x21d7, 0x2237,
0x1075, 0x088f, 0x1580, 0x1489, 0x1c90, 0x21b3, 0x05cb, 0x1211, 0x016d, 0x0e32,
0x1843, 0x00e7, 0x21fb, 0x0747, 0x0570, 0x1b80, 0x182c, 0x034f, 0x092b, 0x15cb,
0x1ccc, 0x0298, 0x1220, 0x1af8, 0x1b33, 0x0a4c, 0x1213, 0x065a, 0x07c0, 0x121d,
0x215a, 0x1dc9, 0x0665, 0x1003, 0x1651, 0x1eea, 0x0017, 0x0636, 0x0a55, 0x030e,
0x1ee9, 0x216e, 0x0db3, 0x0d6b, 0x19a4, 0x1ab7, 0x19e2, 0x054d, 0x0ccb, 0x0393,
0x18a2, 0x0f0b, 0x011e, 0x11c4,
uint16_t DOOM2_95[] = {
0x0440, 0x182f, 0x023b, 0x062b, 0x09e6, 0x0d08, 0x04a5, 0x2076, 0x006e, 0x0012,
0x113c, 0x1ae1, 0x0926, 0x0cce, 0x127b, 0x016b, 0x01f2, 0x0a95, 0x1a4a, 0x1593,
0x0576, 0x035a, 0x11a9, 0x169f, 0x009f, 0x12b9, 0x10bc, 0x202b, 0x0b64, 0x219c,
0x0581, 0x0862, 0x19e9, 0x1ccf, 0x05b1, 0x12c3, 0x18a0, 0x176b, 0x02a1, 0x145a,
0x1cd0, 0x19ed, 0x1b1d, 0x09fe, 0x1a0f, 0x04b4, 0x2105, 0x0d99, 0x0e8f, 0x0bae,
0x2010, 0x01c5, 0x0778, 0x04eb, 0x02d7, 0x0865, 0x214e, 0x0699, 0x07ed, 0x0e85,
0x0080, 0x097f, 0x0c16, 0x0cd9, 0x0d13, 0x0445, 0x19ac, 0x16fc, 0x0dcb, 0x215b,
0x16b0, 0x200d, 0x20e9, 0x1d55, 0x2135, 0x1805, 0x21b1, 0x033e, 0x17b4, 0x1484,
0x0fca, 0x05d9, 0x0e07, 0x0ed9, 0x1144, 0x1694, 0x0e24, 0x06c2, 0x108f, 0x1985,
0x0fbd, 0x20c6, 0x1bba, 0x0c47, 0x1a1a, 0x0171, 0x0d8a, 0x1e79, 0x0105, 0x1297,
0x0af7, 0x162c, 0x0199, 0x0acc, 0x1683, 0x019a, 0x0b55, 0x115b, 0x0205, 0x0518,
0x1056, 0x0df7, 0x15a4, 0x13c9, 0x0665, 0x12ca, 0x0e62, 0x0fea, 0x0b02, 0x0ed1,
0x0002, 0x1d4b, 0x18f9, 0x162b, 0x164a, 0x1a4b, 0x1e7c, 0x1186, 0x1783, 0x1620,
0x167c, 0x1c86, 0x04d8, 0x18e8, 0x0bc7, 0x202b, 0x10d8, 0x1c12, 0x13cc, 0x1285,
0x00b9, 0x1fea, 0x1096, 0x17bd, 0x0065, 0x08dc, 0x1d41, 0x2052, 0x1bb2, 0x1222,
0x12b4, 0x0999, 0x08b8, 0x0622, 0x0206, 0x042b, 0x02c4, 0x0632, 0x006c, 0x14f7,
0x1b21, 0x12e4, 0x0c26, 0x2151, 0x1d78, 0x10d3, 0x14b8, 0x188f, 0x0796, 0x1adc,
0x2266, 0x0674, 0x209d, 0x19c1, 0x003e, 0x13dc, 0x00c3, 0x09af, 0x14f9, 0x0b4a,
0x0828, 0x1d9b, 0x1b0c, 0x1999, 0x0bbe, 0x1250, 0x070c, 0x1ffd, 0x0617, 0x1ce4,
0x22c3, 0x0587, 0x08dd, 0x1637, 0x1817, 0x21f7, 0x0a59, 0x04e6, 0x21bc, 0x2228,
0x10cd, 0x08c8, 0x15db, 0x142d, 0x1ce1, 0x2196, 0x0583, 0x12ea, 0x0154, 0x0eb0,
0x185d, 0x00a1, 0x21f9, 0x0773, 0x059b, 0x1b0e, 0x18b3, 0x03e3, 0x09da, 0x15c0,
0x1c53, 0x0207, 0x120f, 0x1a6e, 0x1bc5, 0x0af9, 0x12a3, 0x063c, 0x07f1, 0x120f,
0x215b, 0x1d07, 0x06c1, 0x106c, 0x161d, 0x1e3c, 0x0010, 0x069b, 0x0a37, 0x0315,
0x1e7e, 0x2139, 0x0d62, 0x0d76, 0x19ff, 0x1a38, 0x1977, 0x0585, 0x0ca7, 0x030d,
0x180f, 0x0f18, 0x0175, 0x1139,
uint16_t DOOM_SE[] = {
0x045c, 0x1847, 0x0214, 0x0680, 0x09b1, 0x0d0a, 0x04e7, 0x207a, 0x00a0, 0x001f,
0x113b, 0x1aa4, 0x09c3, 0x0ce9, 0x12ee, 0x01e4, 0x0185, 0x0a46, 0x1a50, 0x15ac,
0x0526, 0x03c0, 0x11e2, 0x168b, 0x00f2, 0x121d, 0x10a8, 0x20ab, 0x0b2c, 0x216d,
0x05ac, 0x0877, 0x1973, 0x1c7d, 0x0571, 0x1238, 0x1876, 0x173d, 0x02cf, 0x145b,
0x1c3c, 0x1915, 0x1b44, 0x0967, 0x1a8b, 0x04d1, 0x21ee, 0x0da4, 0x0ee9, 0x0b5f,
0x2002, 0x0183, 0x0741, 0x045a, 0x027d, 0x0806, 0x2167, 0x06a6, 0x07cc, 0x0e17,
0x00b7, 0x0981, 0x0cd9, 0x0c61, 0x0d70, 0x04b0, 0x198c, 0x168d, 0x0d63, 0x21b2,
0x167f, 0x202a, 0x20d2, 0x1d54, 0x2122, 0x180c, 0x2155, 0x034a, 0x1799, 0x1461,
0x0fec, 0x05ab, 0x0ed5, 0x0ef1, 0x1160, 0x16b3, 0x0e0d, 0x065e, 0x10fe, 0x1933,
0x0fbf, 0x20a4, 0x1b29, 0x0c9c, 0x1af0, 0x0195, 0x0d3e, 0x1e3d, 0x01f4, 0x12a6,
0x0a87, 0x16d1, 0x0185, 0x0ac3, 0x169e, 0x0163, 0x0bc7, 0x119f, 0x0250, 0x05d9,
0x1097, 0x0db4, 0x15f4, 0x137e, 0x062b, 0x12d0, 0x0e9f, 0x0f40, 0x0b25, 0x0e66,
0x004a, 0x1d73, 0x1810, 0x1691, 0x1614, 0x1aa7, 0x1ee8, 0x113e, 0x173f, 0x1645,
0x168f, 0x1cd8, 0x0484, 0x1825, 0x0b62, 0x20ac, 0x1028, 0x1c8d, 0x1315, 0x1295,
0x00b6, 0x1f34, 0x1071, 0x170e, 0x0099, 0x0872, 0x1d9c, 0x206c, 0x1bc6, 0x1219,
0x12fe, 0x096b, 0x08ef, 0x06b9, 0x02db, 0x04fe, 0x020a, 0x0656, 0x0052, 0x1473,
0x1bd0, 0x122c, 0x0c28, 0x215a, 0x1d10, 0x10ff, 0x14e8, 0x18e2, 0x0705, 0x1afd,
0x2229, 0x067b, 0x20a3, 0x198d, 0x0046, 0x13d7, 0x00f5, 0x097e, 0x14bc, 0x0bdc,
0x08b7, 0x1d50, 0x1bfe, 0x1946, 0x0b0a, 0x1276, 0x079d, 0x1f0a, 0x06c2, 0x1cc4,
0x22c3, 0x0560, 0x08f5, 0x1690, 0x1857, 0x219a, 0x0a0b, 0x044d, 0x2116, 0x22fd,
0x10c3, 0x08a6, 0x15e3, 0x1479, 0x1c1c, 0x21a9, 0x0537, 0x12cb, 0x0157, 0x0ed8,
0x1850, 0x00e1, 0x2174, 0x071a, 0x0575, 0x1b71, 0x183f, 0x038d, 0x0949, 0x1543,
0x1c47, 0x0241, 0x12da, 0x1ac7, 0x1bb3, 0x0a61, 0x1266, 0x06d9, 0x0731, 0x1211,
0x212d, 0x1d40, 0x0664, 0x1002, 0x16ff, 0x1e78, 0x007b, 0x0652, 0x0a88, 0x0309,
0x1e33, 0x219f, 0x0d30, 0x0d96, 0x19d5, 0x1ac0, 0x19a3, 0x0543, 0x0c35, 0x0378,
0x189b, 0x0fa6, 0x0126, 0x110e,
uint16_t FINALDOS[] = {
0x04ef, 0x1839, 0x0270, 0x06af, 0x0922, 0x0d0e, 0x043f, 0x2047, 0x00a9, 0x0049,
0x1191, 0x1a66, 0x092c, 0x0ca6, 0x1206, 0x01a0, 0x018b, 0x0a12, 0x1a49, 0x15fd,
0x05da, 0x03ff, 0x1105, 0x160f, 0x00d6, 0x12ae, 0x1041, 0x2083, 0x0b25, 0x2107,
0x055c, 0x0898, 0x1993, 0x1c2d, 0x0578, 0x12b0, 0x1883, 0x17ea, 0x0247, 0x1404,
0x1c9c, 0x1916, 0x1b91, 0x092d, 0x1aca, 0x047b, 0x21d5, 0x0dc9, 0x0e38, 0x0b24,
0x20db, 0x0170, 0x07e9, 0x0436, 0x023a, 0x0880, 0x2170, 0x0665, 0x0704, 0x0e88,
0x00fc, 0x0921, 0x0cc7, 0x0c6c, 0x0d7f, 0x0433, 0x1913, 0x164c, 0x0d1c, 0x2167,
0x1601, 0x20c9, 0x20e0, 0x1d27, 0x2162, 0x18b0, 0x21ee, 0x03ee, 0x1744, 0x1432,
0x0f2a, 0x0578, 0x0ef7, 0x0e4d, 0x1178, 0x16e2, 0x0ee4, 0x0688, 0x1009, 0x198f,
0x0f2a, 0x20d2, 0x1b75, 0x0ce5, 0x1a96, 0x0197, 0x0d64, 0x1e20, 0x0159, 0x1271,
0x0a38, 0x163e, 0x016e, 0x0a19, 0x16da, 0x0172, 0x0b18, 0x118d, 0x0228, 0x05a2,
0x106d, 0x0df6, 0x1515, 0x1374, 0x0699, 0x123e, 0x0e03, 0x0f33, 0x0b94, 0x0e8d,
0x0046, 0x1d47, 0x18fc, 0x1667, 0x1684, 0x1a32, 0x1e8f, 0x114e, 0x1759, 0x16e2,
0x16d8, 0x1ca9, 0x0470, 0x182a, 0x0b14, 0x20d6, 0x10a1, 0x1cac, 0x133f, 0x124f,
0x00c9, 0x1f48, 0x1090, 0x176f, 0x0025, 0x08f8, 0x1ddd, 0x20ba, 0x1ba7, 0x1233,
0x12dc, 0x09aa, 0x08c6, 0x0654, 0x021f, 0x048d, 0x0287, 0x06d3, 0x00d9, 0x1412,
0x1bd6, 0x1210, 0x0c81, 0x21e0, 0x1d42, 0x10d3, 0x148f, 0x182c, 0x0749, 0x1aba,
0x2245, 0x06e4, 0x20b9, 0x1914, 0x00c3, 0x13e7, 0x0045, 0x09c0, 0x14bc, 0x0b4f,
0x089f, 0x1d91, 0x1b74, 0x19e5, 0x0b9f, 0x1277, 0x07cd, 0x1f80, 0x0607, 0x1c9e,
0x228f, 0x059a, 0x08a0, 0x1655, 0x188c, 0x214a, 0x0ad5, 0x047a, 0x21be, 0x2202,
0x10eb, 0x088a, 0x155d, 0x148d, 0x1cce, 0x219d, 0x052c, 0x1206, 0x019d, 0x0e3d,
0x1872, 0x0032, 0x217a, 0x0753, 0x050e, 0x1bf0, 0x180f, 0x0312, 0x09a9, 0x15b8,
0x1c9b, 0x0289, 0x1265, 0x1a4c, 0x1b8b, 0x0ab5, 0x1245, 0x06a1, 0x07ba, 0x128a,
0x21e4, 0x1d55, 0x061a, 0x1040, 0x16fa, 0x1e07, 0x0059, 0x06f0, 0x0af8, 0x03f6,
0x1e76, 0x218d, 0x0d77, 0x0d3c, 0x1980, 0x1ad3, 0x1966, 0x0558, 0x0c41, 0x03d4,
0x18fc, 0x0faf, 0x0111, 0x1166,
uint16_t FINAL[] = {
0x0415, 0x18b2, 0x0261, 0x06d7, 0x0959, 0x0d48, 0x0481, 0x20ed, 0x00c8, 0x00a9,
0x1185, 0x1a9b, 0x099b, 0x0c9e, 0x12c5, 0x01b8, 0x0152, 0x0abb, 0x1ae1, 0x15d5,
0x050a, 0x0321, 0x1130, 0x1680, 0x00b9, 0x1259, 0x106b, 0x2042, 0x0baf, 0x2119,
0x05f6, 0x0807, 0x1983, 0x1c54, 0x05f5, 0x128c, 0x1835, 0x17ca, 0x0235, 0x14d0,
0x1c23, 0x19c2, 0x1bcb, 0x0913, 0x1a14, 0x0441, 0x21b5, 0x0dc9, 0x0e0e, 0x0b25,
0x20d1, 0x0198, 0x0706, 0x04ad, 0x02c8, 0x0842, 0x21e9, 0x06a5, 0x07f7, 0x0e18,
0x000d, 0x090c, 0x0c6a, 0x0c30, 0x0dff, 0x0450, 0x1996, 0x16e7, 0x0df9, 0x2158,
0x1648, 0x20cb, 0x2044, 0x1d51, 0x2126, 0x1884, 0x21e1, 0x0390, 0x174e, 0x1432,
0x0f53, 0x0512, 0x0ed2, 0x0ed5, 0x1187, 0x1626, 0x0e82, 0x06de, 0x1046, 0x1990,
0x0fe6, 0x202e, 0x1b1d, 0x0ceb, 0x1ab0, 0x01c3, 0x0d96, 0x1e1e, 0x01c6, 0x12c2,
0x0abd, 0x16cf, 0x01ab, 0x0a52, 0x16f5, 0x01d9, 0x0b82, 0x117d, 0x02a5, 0x05aa,
0x1016, 0x0da4, 0x1586, 0x1393, 0x0687, 0x12da, 0x0e14, 0x0f43, 0x0b06, 0x0e63,
0x0024, 0x1d0b, 0x18ac, 0x1609, 0x165f, 0x1a36, 0x1ece, 0x1158, 0x17a8, 0x16b7,
0x1674, 0x1c73, 0x0496, 0x1834, 0x0bb0, 0x20b0, 0x1055, 0x1cd9, 0x131d, 0x1285,
0x0057, 0x1fa6, 0x1049, 0x1792, 0x0066, 0x084e, 0x1d3b, 0x2041, 0x1bae, 0x12c5,
0x12b3, 0x090c, 0x082e, 0x0605, 0x02c2, 0x0418, 0x021c, 0x06b7, 0x00e6, 0x146f,
0x1b8c, 0x1228, 0x0c8f, 0x213f, 0x1d48, 0x1000, 0x1440, 0x1844, 0x07ee, 0x1a7c,
0x2291, 0x06a4, 0x20ff, 0x19dc, 0x00f7, 0x13ec, 0x00fc, 0x0927, 0x146e, 0x0bb2,
0x0879, 0x1d8e, 0x1bec, 0x1960, 0x0ba2, 0x1221, 0x074b, 0x1f22, 0x06be, 0x1cd2,
0x2238, 0x05ce, 0x08d5, 0x1645, 0x187a, 0x219d, 0x0a4d, 0x04c3, 0x2144, 0x221e,
0x100b, 0x0859, 0x1542, 0x14dc, 0x1ca5, 0x2185, 0x0536, 0x123f, 0x01a2, 0x0ef3,
0x18e1, 0x0026, 0x21ae, 0x0774, 0x0520, 0x1b8e, 0x1829, 0x03b5, 0x099f, 0x15bb,
0x1ca4, 0x0240, 0x1243, 0x1a10, 0x1b9f, 0x0ac7, 0x12ac, 0x065e, 0x0762, 0x12fb,
0x21fa, 0x1dc8, 0x0657, 0x1043, 0x161b, 0x1e9e, 0x0087, 0x06b5, 0x0a0c, 0x0348,
0x1e28, 0x21b8, 0x0d8e, 0x0dd8, 0x19d3, 0x1a8a, 0x1977, 0x0505, 0x0cd0, 0x03a1,
0x18db, 0x0fb7, 0x013d, 0x110f,
uint16_t QUAKE[] = {
0x04d8, 0x18cd, 0x02d6, 0x06b0, 0x0945, 0x0d83, 0x045a, 0x2027, 0x00b8, 0x0019,
0x1131, 0x1afb, 0x09bd, 0x0ce5, 0x123b, 0x014c, 0x015b, 0x0a47, 0x1a94, 0x1528,
0x05e4, 0x0383, 0x116c, 0x16b2, 0x002e, 0x129f, 0x10d3, 0x20b1, 0x0ba2, 0x21a0,
0x0501, 0x0825, 0x19fb, 0x1cc8, 0x05ba, 0x1248, 0x183c, 0x1712, 0x02ed, 0x1478,
0x1c69, 0x198e, 0x1ba9, 0x09cd, 0x1af7, 0x041f, 0x2117, 0x0d42, 0x0e79, 0x0b9c,
0x2024, 0x01a9, 0x072f, 0x0436, 0x029b, 0x08be, 0x2196, 0x0641, 0x0719, 0x0e22,
0x008f, 0x09c7, 0x0c4f, 0x0c6b, 0x0d16, 0x04ee, 0x1978, 0x16c1, 0x0dfb, 0x212a,
0x1682, 0x20c8, 0x20f7, 0x1d06, 0x21f0, 0x187b, 0x21f3, 0x03d0, 0x1780, 0x147e,
0x0fb4, 0x05d7, 0x0e15, 0x0e7e, 0x1117, 0x16a9, 0x0e73, 0x061e, 0x1073, 0x19d5,
0x0f23, 0x20b9, 0x1b71, 0x0c6d, 0x1a48, 0x0180, 0x0d13, 0x1edd, 0x015e, 0x12b7,
0x0afb, 0x16c1, 0x01b6, 0x0a9f, 0x160d, 0x0115, 0x0b8f, 0x11c6, 0x028f, 0x0508,
0x1022, 0x0d6a, 0x15c8, 0x13e4, 0x06fe, 0x129e, 0x0ef1, 0x0f29, 0x0b2e, 0x0e29,
0x008f, 0x1d4f, 0x186d, 0x1627, 0x166f, 0x1a79, 0x1e29, 0x1119, 0x177e, 0x1682,
0x1622, 0x1cda, 0x04c6, 0x18e7, 0x0bc1, 0x20a0, 0x1029, 0x1c82, 0x1329, 0x1209,
0x00b9, 0x1fb4, 0x106d, 0x177b, 0x0007, 0x08e7, 0x1de6, 0x2088, 0x1b4e, 0x1292,
0x1227, 0x09e2, 0x0860, 0x06a3, 0x021d, 0x041b, 0x026c, 0x0663, 0x00e6, 0x1454,
0x1b6e, 0x1226, 0x0c64, 0x21cd, 0x1d97, 0x1026, 0x141b, 0x1840, 0x07a4, 0x1a93,
0x2291, 0x0620, 0x202b, 0x1951, 0x00c3, 0x1306, 0x0017, 0x0972, 0x14b0, 0x0b87,
0x08e9, 0x1d3b, 0x1b0d, 0x196e, 0x0b13, 0x12ca, 0x073b, 0x1f82, 0x0627, 0x1c62,
0x2211, 0x05c7, 0x0882, 0x16b5, 0x188e, 0x2126, 0x0ae7, 0x04ad, 0x21c9, 0x2219,
0x10fd, 0x08f7, 0x1543, 0x147d, 0x1c31, 0x2180, 0x0573, 0x12b1, 0x01a7, 0x0e76,
0x1804, 0x0038, 0x2133, 0x07c8, 0x05b0, 0x1bfd, 0x1804, 0x038c, 0x09ad, 0x158f,
0x1c18, 0x0212, 0x1299, 0x1a95, 0x1b98, 0x0a19, 0x1266, 0x0694, 0x076c, 0x12f3,
0x2165, 0x1d66, 0x0684, 0x10ba, 0x1613, 0x1ed0, 0x001d, 0x0678, 0x0ab6, 0x0370,
0x1e2b, 0x216b, 0x0d56, 0x0d41, 0x19d9, 0x1abc, 0x199f, 0x052a, 0x0c6d, 0x032c,
0x1893, 0x0f2f, 0x01a8, 0x1119,
uint16_t QUAKE2[] = {
0x046f, 0x18b4, 0x0297, 0x06bf, 0x091e, 0x0d53, 0x0445, 0x20d5, 0x008e, 0x0000,
0x113a, 0x1ad9, 0x0925, 0x0c3c, 0x12b6, 0x01c2, 0x01b2, 0x0a48, 0x1a67, 0x15fe,
0x05b0, 0x03f4, 0x11dc, 0x16e9, 0x00d4, 0x12bf, 0x100a, 0x205c, 0x0b77, 0x21e9,
0x0596, 0x08fd, 0x1995, 0x1c92, 0x05b7, 0x12e2, 0x18bc, 0x1797, 0x02d5, 0x146d,
0x1c27, 0x19b4, 0x1b0d, 0x09d1, 0x1a8d, 0x0480, 0x2103, 0x0d61, 0x0edc, 0x0bd9,
0x20f9, 0x0186, 0x076f, 0x0486, 0x0254, 0x0894, 0x2153, 0x06ea, 0x07ba, 0x0e8c,
0x0040, 0x09b4, 0x0c32, 0x0cd8, 0x0d73, 0x0409, 0x195e, 0x16ba, 0x0d9e, 0x212c,
0x1655, 0x2044, 0x20f0, 0x1d1b, 0x2104, 0x1895, 0x211d, 0x0326, 0x17b8, 0x14a3,
0x0fa0, 0x0586, 0x0e7c, 0x0e62, 0x11ed, 0x1696, 0x0e81, 0x06ad, 0x1065, 0x19e2,
0x0f26, 0x206f, 0x1bb2, 0x0c90, 0x1a4d, 0x0139, 0x0d7d, 0x1e36, 0x014b, 0x12a9,
0x0a85, 0x161c, 0x017e, 0x0ac6, 0x164b, 0x01fd, 0x0b0a, 0x11f3, 0x02cc, 0x05c4,
0x106d, 0x0d56, 0x15e0, 0x130e, 0x0627, 0x124e, 0x0eb9, 0x0fcf, 0x0b50, 0x0e3a,
0x00f3, 0x1dda, 0x1807, 0x1606, 0x167e, 0x1a8e, 0x1e33, 0x11d7, 0x1767, 0x1643,
0x169c, 0x1ced, 0x045b, 0x18c0, 0x0b40, 0x204f, 0x104b, 0x1c62, 0x1338, 0x12b0,
0x0014, 0x1fd8, 0x10f6, 0x17a4, 0x00cd, 0x085f, 0x1db9, 0x2019, 0x1b2f, 0x12ed,
0x1286, 0x09e6, 0x0845, 0x06ff, 0x02e6, 0x04b4, 0x0290, 0x063a, 0x0016, 0x1485,
0x1bc1, 0x1235, 0x0cf2, 0x21ca, 0x1da7, 0x1030, 0x145d, 0x1803, 0x079c, 0x1af3,
0x229b, 0x061d, 0x2051, 0x19d4, 0x00f9, 0x13ba, 0x0094, 0x0995, 0x145f, 0x0b16,
0x080d, 0x1d1a, 0x1b54, 0x193b, 0x0b60, 0x1213, 0x0736, 0x1f3c, 0x06d8, 0x1c1d,
0x22ff, 0x0500, 0x089b, 0x163d, 0x18ef, 0x2144, 0x0a7f, 0x0432, 0x2127, 0x22bd,
0x10db, 0x0875, 0x15b8, 0x14d2, 0x1c75, 0x21ae, 0x053e, 0x12a7, 0x01b0, 0x0e85,
0x187b, 0x00e9, 0x2199, 0x075c, 0x0573, 0x1bea, 0x1840, 0x0399, 0x094a, 0x1566,
0x1c30, 0x0278, 0x12a2, 0x1a75, 0x1bb4, 0x0a59, 0x1236, 0x0695, 0x075e, 0x1257,
0x213c, 0x1dda, 0x068f, 0x10fc, 0x1617, 0x1ea7, 0x00a3, 0x06fb, 0x0aa0, 0x032f,
0x1ef2, 0x218a, 0x0d14, 0x0dc3, 0x19f3, 0x1a4e, 0x1974, 0x0514, 0x0c47, 0x0343,
0x182a, 0x0fd0, 0x0127, 0x1178,
uint32_t reverse_bits(uint32_t val, uint32_t num_bits) {
//printf("reverse bits input: val: %d, num_bits: %d\n", val, num_bits);
uint32_t reversed = 0;
while(num_bits) {
reversed = (val & 1) | (reversed << 1); //asm adds to itself, is that faster?
val >>= 1;
return reversed;
uint64_t count_shift(int64_t shift,uint64_t other) {
shift -= 2;
uint64_t count = 7;
uint64_t result = 0;
while(shift >= 0) {
if(other >> shift) {
result += (1 << (count - 1)) - 1;
other &= ~(1 << shift);
//printf("count_shift result: %lu\n", result);
return result;
uint64_t set_from_shift(uint64_t a, uint64_t b) {
printf("set_from_shift input - a: %lu, b: %lu\n", a, b);
uint64_t shift, set_bits;
uint64_t high_bit = 1 << b-1;
shift = 1;
set_bits = 0;
while (a) {
set_bits *= 2;
if(a & high_bit) {
set_bits |= 1;
a -= 1;
shift += 1;
a %= high_bit;
high_bit >>= 1;
printf("end while loop set_bits: %lu\n", set_bits);
printf("end while loop shift: %lu\n", shift);
uint64_t result = set_bits + ((1 << (shift - 1)) >> 1);
printf("set_from_shift result: %lu\n", result);
return result;
unsigned long get_mem_val(uint64_t shift,uint64_t bits,uint64_t game_num) {
//printf("get_mem_val input - shift: %lu, bits: %lu, game_num: %lu\n", shift, bits, game_num);
if(game_num > 14) {
printf("incorrect game number (I only have 15 set up right now.)\n");
uint16_t *game_mem = MEM_BLOCKS[game_num];
uint64_t mem_val = game_mem[254 - 2*set_from_shift(count_shift(shift, bits) + 1, 8)];
//printf("initial mem_val: %lu\n", mem_val);
while(shift > 1) {
mem_val^=game_mem[255-2*set_from_shift(count_shift(shift, bits)+1, 8)];
return mem_val;
uint64_t keygen(char *challenge) {
char ch_4[5];
char ch_7[8];
unsigned long a, x, y, z, breg, sreg, game_num, ecx, orresult, shift_bits, bits_to_reverse, bits, shift, edx, valid, rbp0x17cLower7, rbp0x184;
if(strlen(challenge) != 12) {
printf("Invalid challenge string length\n");
return -1;
strncpy(ch_4, challenge+1, 4);
ch_4[4] = '\0';
strncpy(ch_7, challenge+5, 7);
ch_7[7] = '\0';
sreg = strtoul(ch_4, NULL, 10);
breg = strtoul(ch_7, NULL, 10);
x = (sreg*0x3f)^breg;
y = x/0x103;
z = y/0x81;
game_num = y%0x81;
edx = sreg & 0x7F;
a = (z/7) + (sreg>>7) + edx + game_num + (z%7);
valid = a == x%0x103;
rbp0x17cLower7 = game_num & 0x7F;
rbp0x184 = edx & 0xFF;
rbp0x184 = (rbp0x184 << 3) & 0xFF;
ecx = (z%7) & 0xFF;
orresult = rbp0x184 | ecx;
uint64_t loworresult = orresult & 7;
shift_bits = 1 << loworresult;
bits_to_reverse = (shift_bits-1) & (orresult >> 3);
bits = shift_bits - reverse_bits(bits_to_reverse, loworresult) - 1;
//printf("bits: %lu\n", bits);
shift = loworresult + 1;
uint64_t mem_val = get_mem_val(shift, bits, game_num);
//printf("mem_val: %lu\n", mem_val);
uint64_t reverse_game_mem = reverse_bits(game_num, 7) + mem_val + 0x18;
//printf("reverse_game_mem: %lu\n", reverse_game_mem);
uint64_t key = (reverse_game_mem - (reverse_game_mem & 0xFFF80) + 0x83*((mem_val ^ 0x1EA3) + 0x1700A1));
return key;
void main(int argc, char* argv[]) {
if(argc < 2) {
printf("Usage: %s <challenge>\n", argv[0]);
printf("B%lu\n", keygen(argv[1]));