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];
md5_state_t ctx;
int i;
int k;
int *ix;
if (len < 16) {
@ -32,7 +33,9 @@ void login_calculate(char *out, int len, char *pass, int seed) {
memcpy(temp, pass, 32);
ix = (int*) temp;
for (i = 0; i < 8; i++) {
*ix++ ^= seed;
k = ntohl(*ix);
k ^= seed;
*ix++ = htonl(k);
}
md5_init(&ctx);
md5_append(&ctx, temp, 32);