mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 18:15:13 +00:00
knf
This commit is contained in:
parent
3015cc33b2
commit
8383344817
17
src/login.c
17
src/login.c
@ -20,27 +20,32 @@
|
|||||||
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
|
|
||||||
/* Needs a 16byte array for output, and 32 bytes password */
|
/*
|
||||||
void login_calculate(char *out, int len, char *pass, int seed) {
|
* Needs a 16byte array for output, and 32 bytes password
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
login_calculate(char *buf, int buflen, char *pass, int seed)
|
||||||
|
{
|
||||||
unsigned char temp[32];
|
unsigned char temp[32];
|
||||||
md5_state_t ctx;
|
md5_state_t ctx;
|
||||||
|
int *ix;
|
||||||
int i;
|
int i;
|
||||||
int k;
|
int k;
|
||||||
int *ix;
|
|
||||||
|
|
||||||
if (len < 16) {
|
if (buflen < 16)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
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++) {
|
||||||
k = ntohl(*ix);
|
k = ntohl(*ix);
|
||||||
k ^= seed;
|
k ^= seed;
|
||||||
*ix++ = htonl(k);
|
*ix++ = htonl(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
md5_init(&ctx);
|
md5_init(&ctx);
|
||||||
md5_append(&ctx, temp, 32);
|
md5_append(&ctx, temp, 32);
|
||||||
md5_finish(&ctx, (unsigned char *) out);
|
md5_finish(&ctx, (unsigned char *) buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user