The three-byte magic numbers would match 1 in about every 16 million
guessed passwords, which is too frequent for exhaustive testing. The new
7- and 10-byte magic numbers should not have the same problem.
rijndaelDecrypt (f->rk, f->Nr,
CHAR_CAST (const char *, f->ciphertext),
CHAR_CAST (char *, f->plaintext));
- return !memcmp (f->plaintext, f->type == SYSTEM ? "$FL" : "* E", 3);
+
+ const char *magic = f->type == SYSTEM ? "$FL?@(#)" : "* Encoding";
+ for (int i = 0; magic[i]; i++)
+ if (magic[i] != '?' && f->plaintext[i] != magic[i])
+ return false;
+ return true;
}
static bool