static char *split(char *ciphertext, int index) { static char out[MAX_CIPHERTEXT_LENGTH + 1]; int i = 0; for (; ciphertext[i] && i < MAX_CIPHERTEXT_LENGTH; i++) out[i] = ciphertext[i]; out[i] = 0; // lowercase salt as well as hash, encoding-aware enc_strlwr(&out[6]); return out; }
static void *salt(char *ciphertext) { static mscash_salt salt; char *pos = ciphertext + strlen(mscash_prefix); int length = 0; memset(&salt, 0, sizeof(salt)); while (*pos != '#') { if (length == SALT_LENGTH) return NULL; salt.salt[length++] = *pos++; } salt.salt[length] = 0; enc_strlwr(salt.salt); salt.length = length; return &salt; }