Look at the source code of FreeTDS:
unsigned char *
Tds7_crypt_pass (const unsigned char *clear_pass, int len, unsigned char *crypt_pass)
{
int i;
for (i = 0; i < len; i++)
Crypt_pass[i] = ((Clear_pass[i] << 4) | (Clear_pass[i] >> 4)) ^ 0xa5;
return crypt_pass;
}
Call: Tds7_crypt_pass ((unsigned char *) unicode_string, Password_len, (unsigned char *) unicode_string);
This, Wireshark has already resolved. It was just that I didn't know which algorithm to implement.
Attach Debug Code:
#include <stdio.h>
#include "stdlib.h"
#include <string.h>
unsigned char *tds7_crypt_pass ( Const unsigned char *clear_pass, int len, unsigned char *crypt_pass)
{
int i;
&NBSP
for (i = 0;i < Len; i++)
crypt_pass[i] = ((clear_pass[i) << 4) | (Clear_pass[i] >> 4)) ^ 0xa5;
return Crypt_pass;
}
int main ()
{
const unsigned char password[]= "abc123";
unsigned Char buf[30];
unsigned Char *encrpted_pass=buf;
int i;
memset (encrpted_pass,0,sizeof (BUF));
tds7_crypt_pass (password,sizeof (password) -1,encrpted_pass);
for (i=0;i<sizeof (password) -1;i++)
{
printf ("%c ", Password[i]);
printf ("%x/n", Encrpted_pass[i]);
}
return 0;
}