1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-29 16:36:03 +03:00

Fix login_calculate on wrong endian

This commit is contained in:
Erik Ekman 2007-01-28 04:10:37 +00:00
parent 2a860e3528
commit eed9e7063d

View File

@ -23,6 +23,7 @@ void login_calculate(char *out, int len, char *pass, int seed) {
char temp[32]; char temp[32];
md5_state_t ctx; md5_state_t ctx;
int i; int i;
int k;
int *ix; int *ix;
if (len < 16) { if (len < 16) {
@ -30,9 +31,11 @@ void login_calculate(char *out, int len, char *pass, int seed) {
} }
memcpy(temp, pass, 32); memcpy(temp, pass, 32);
ix = (int *) temp; ix = (int*) temp;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
*ix++ ^= seed; k = ntohl(*ix);
k ^= seed;
*ix++ = htonl(k);
} }
md5_init(&ctx); md5_init(&ctx);
md5_append(&ctx, temp, 32); md5_append(&ctx, temp, 32);