static void test_login_hash(const char *password, uint32_t seed, const char *expect) { uint8_t result[20]; if (gg_login_hash_sha1_2(password, seed, result) == -1) { fprintf(stderr, "gg_login_hash_sha1_2() failed for \"%s\", 0x%08x\n", password, seed); exit(1); } if (!sha1_compare(result, expect)) { printf("hash failed for \"%s\", 0x%08x, expected %s, got %s\n", password, seed, expect, sha1_to_string(result)); exit(1); } }
void gg_login_hash_sha1(const char *password, uint32_t seed, uint8_t *result) { if (gg_login_hash_sha1_2(password, seed, result) != 0) memset(result, 0, 20); }