+ MD5Init(&ctx);
+ MD5Update(&ctx, username, strlen(username));
+ MD5Update(&ctx, password, strlen(password));
+ MD5Final((unsigned char *)givenpw, &ctx);
+
+ if (strncmp(givenpw, epw, MD5_DIGEST_SIZE) == 0)
+ return 1;
+ else
+ return 0;
+}
+
+int auth_check_password_v1(const char *username, const char *password) {
+ unsigned char epw[SCRYPT_OUTPUT_SIZE];
+ uint8_t esalt[SCRYPT_SALT_SIZE];
+ unsigned char givenpw[SCRYPT_OUTPUT_SIZE];
+ int r;
+
+ if (auth_get_password(username, (char *)epw) == 0)
+ return 0;
+
+ if (auth_get_salt(username, esalt) == 0)
+ return 0;
+
+ r = crypto_scrypt((const uint8_t *)password, strlen(password), esalt, SCRYPT_SALT_SIZE, SCRYPT_N, SCRYPT_r, SCRYPT_p, givenpw, SCRYPT_OUTPUT_SIZE);
+ if (r != 0) {
+ fprintf(stderr, "Failure in scrypt for %s\n", username);
+ return 0;
+ }
+
+ if (memcmp(givenpw, epw, SCRYPT_OUTPUT_SIZE) == 0)