This commit is contained in:
Connor 2018-10-09 22:27:51 -07:00 committed by GitHub
parent 4031c2dbda
commit eeed9ea275

12
thps1.c
View file

@ -55,7 +55,7 @@ s32 mult_lo(s32 a, s32 b) {
return (s32)(((s64)a * (s64)b) & 0xFFFFFFFF); return (s32)(((s64)a * (s64)b) & 0xFFFFFFFF);
} }
void fuckery(code_t *code) { void decode(code_t *code) {
u32 r = 0; u32 r = 0;
u32 a3 = 0x98534637; u32 a3 = 0x98534637;
@ -101,11 +101,13 @@ void print_code(const code_t *code) {
int validate_entry(const char *entry) { int validate_entry(const char *entry) {
code_t code = {0}; code_t code = {0};
int i = 0; for (int i = 0; i < 13; i++) {
while (entry[i] && i < 13) code.name[i++] = entry[i]; code.name[i] = entry[i];
if (entry[i] == '\0') break;
}
translate(code.name); translate(code.name);
fuckery(&code); decode(&code);
int result = validate(&code); int result = validate(&code);
if (result) print_code(&code); if (result) print_code(&code);
@ -137,7 +139,7 @@ CEIQQHURYAJAV
while (found < count) { while (found < count) {
for (int j = 0; j < 13; j++) code.name[j] = prng() % 27; for (int j = 0; j < 13; j++) code.name[j] = prng() % 27;
//for (int j = 3; j < 13; j++) code.name[j] = 26; //for (int j = 3; j < 13; j++) code.name[j] = 26;
fuckery(&code); decode(&code);
if (validate(&code)) { if (validate(&code)) {
found++; found++;
print_code(&code); print_code(&code);