version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.3, 2021/03/17 00:39:23
|
Line 55
|
Line 55
|
void |
void |
LMPasswordHash(const char *password, u_char *hash) |
LMPasswordHash(const char *password, u_char *hash) |
{ |
{ |
const u_char *const clear = (u_char *) "KGS!@#$%%"; | const u_char* clear = (const u_char *)"KGS!@#$%%"; |
u_char up[14]; /* upper case password */ |
u_char up[14]; /* upper case password */ |
int k; | unsigned k; |
|
|
memset(&up, 0, sizeof(up)); |
memset(&up, 0, sizeof(up)); |
for (k = 0; k < sizeof(up) && password[k]; k++) |
for (k = 0; k < sizeof(up) && password[k]; k++) |
Line 78 void
|
Line 78 void
|
NTPasswordHash(const char *password, u_char *hash) |
NTPasswordHash(const char *password, u_char *hash) |
{ |
{ |
u_int16_t unipw[128]; |
u_int16_t unipw[128]; |
int unipwLen; | unsigned unipwLen; |
MD4_CTX md4ctx; |
MD4_CTX md4ctx; |
const char *s; |
const char *s; |
|
|
Line 107 NTPasswordHashHash(const u_char *nthash, u_char *hash)
|
Line 107 NTPasswordHashHash(const u_char *nthash, u_char *hash)
|
MD4_CTX md4ctx; |
MD4_CTX md4ctx; |
|
|
MD4_Init(&md4ctx); |
MD4_Init(&md4ctx); |
MD4_Update(&md4ctx, (u_char *) nthash, 16); | MD4_Update(&md4ctx, nthash, 16); |
MD4_Final(hash, &md4ctx); |
MD4_Final(hash, &md4ctx); |
} |
} |
|
|
Line 164 ChallengeResponse(const u_char *chal, const char *pwHa
|
Line 164 ChallengeResponse(const u_char *chal, const char *pwHa
|
static void |
static void |
DesEncrypt(const u_char *clear, u_char *key0, u_char *cypher) |
DesEncrypt(const u_char *clear, u_char *key0, u_char *cypher) |
{ |
{ |
des_key_schedule ks; | DES_key_schedule ks; |
u_char key[8]; |
u_char key[8]; |
|
|
/* Create DES key */ |
/* Create DES key */ |
Line 177 DesEncrypt(const u_char *clear, u_char *key0, u_char *
|
Line 177 DesEncrypt(const u_char *clear, u_char *key0, u_char *
|
key[5] = (key0[4] << 3) | (key0[5] >> 5); |
key[5] = (key0[4] << 3) | (key0[5] >> 5); |
key[6] = (key0[5] << 2) | (key0[6] >> 6); |
key[6] = (key0[5] << 2) | (key0[6] >> 6); |
key[7] = key0[6] << 1; |
key[7] = key0[6] << 1; |
des_set_key((des_cblock *) key, ks); | DES_set_key((DES_cblock *) key, &ks); |
|
|
/* Encrypt using key */ |
/* Encrypt using key */ |
|
|
des_ecb_encrypt((des_cblock *) clear, (des_cblock *) cypher, ks, 1); | #ifdef __clang__ |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wcast-qual" |
| #endif |
| DES_ecb_encrypt((const_DES_cblock *) clear, (DES_cblock *) cypher, &ks, 1); |
| #ifdef __clang__ |
| #pragma clang diagnostic pop |
| #endif |
} |
} |
|
|
/* |
/* |