| 1556 GaimCipherContext *ctx; |
1556 GaimCipherContext *ctx; |
| 1557 int i; |
1557 int i; |
| 1558 unsigned char Kxoripad[65]; |
1558 unsigned char Kxoripad[65]; |
| 1559 unsigned char Kxoropad[65]; |
1559 unsigned char Kxoropad[65]; |
| 1560 int pwlen; |
1560 int pwlen; |
| 1561 char * pwinput; |
|
| 1562 guchar md5buf[16]; |
|
| 1563 |
1561 |
| 1564 cipher = gaim_ciphers_find_cipher("md5"); |
1562 cipher = gaim_ciphers_find_cipher("md5"); |
| 1565 ctx = gaim_cipher_context_new(cipher, NULL); |
1563 ctx = gaim_cipher_context_new(cipher, NULL); |
| 1566 |
1564 |
| 1567 pwinput=(char *)passwd; |
1565 memset(Kxoripad,0,sizeof(Kxoripad)); |
| |
1566 memset(Kxoropad,0,sizeof(Kxoropad)); |
| |
1567 |
| 1568 pwlen=strlen(passwd); |
1568 pwlen=strlen(passwd); |
| 1569 if (pwlen>64) { |
1569 if (pwlen>64) { |
| 1570 gaim_cipher_context_append(ctx, (const guchar *)passwd, strlen(passwd)); |
1570 gaim_cipher_context_append(ctx, (const guchar *)passwd, strlen(passwd)); |
| 1571 gaim_cipher_context_digest(ctx, sizeof(md5buf), md5buf, NULL); |
1571 gaim_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); |
| 1572 pwinput=(char *)md5buf; |
|
| 1573 pwlen=16; |
1572 pwlen=16; |
| 1574 } |
1573 } else { |
| 1575 |
1574 memcpy(Kxoripad, passwd, pwlen); |
| 1576 memset(Kxoripad,0,sizeof(Kxoripad)); |
1575 } |
| 1577 memset(Kxoropad,0,sizeof(Kxoropad)); |
1576 memcpy(Kxoropad,Kxoripad,pwlen); |
| 1578 memcpy(Kxoripad,pwinput,pwlen); |
1577 |
| 1579 memcpy(Kxoropad,pwinput,pwlen); |
|
| 1580 for (i=0;i<64;i++) { |
1578 for (i=0;i<64;i++) { |
| 1581 Kxoripad[i]^=0x36; |
1579 Kxoripad[i]^=0x36; |
| 1582 Kxoropad[i]^=0x5c; |
1580 Kxoropad[i]^=0x5c; |
| 1583 } |
1581 } |
| 1584 |
1582 |
| 1588 gaim_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); |
1586 gaim_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); |
| 1589 |
1587 |
| 1590 gaim_cipher_context_reset(ctx, NULL); |
1588 gaim_cipher_context_reset(ctx, NULL); |
| 1591 gaim_cipher_context_append(ctx, Kxoropad, 64); |
1589 gaim_cipher_context_append(ctx, Kxoropad, 64); |
| 1592 gaim_cipher_context_append(ctx, Kxoripad, 16); |
1590 gaim_cipher_context_append(ctx, Kxoripad, 16); |
| 1593 gaim_cipher_context_digest(ctx, sizeof(response), response, NULL); |
1591 gaim_cipher_context_digest(ctx, 16, response, NULL); |
| 1594 |
1592 |
| 1595 gaim_cipher_context_destroy(ctx); |
1593 gaim_cipher_context_destroy(ctx); |
| 1596 } |
1594 } |
| 1597 |
1595 |
| 1598 static void |
1596 static void |