本帖最后由 llztt 于 2012-2-13 10:02 编辑
有个河南网通的用户名算法,不过是C语言的,可否会C的帮忙转成AU3的,谢谢啊
详情见附件//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Application->NormalizeTopMosts();
Application->MessageBox(" 新乡水星科技\n\n\n QQ:511597049\n E-mial:zzbinfo@163.com", "关于" );
Application->RestoreTopMosts();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(Edit1->Text.Length()>0&Edit1->Text.Length()<128)
{
Edit2->Text = "2:"+EnCode(Edit1->Text);
}else
{
ShowMessage(" 用户名错误 !");
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TForm1::EnCode(AnsiString string)
{
char cas_str[]="9012345678abcdeABCDEFGHIJKLMNfghijklmnUVWXYZxyzuvwopqrstOPQRST";
int cas_str_buffer[16];
int cas_esi = 37;
char src_str[128],dec_str[128]="";
int k=0;
int cas_eax,cas_edx;
div_t x;
unsigned int i,j;
cas_str_buffer[15]=25;
cas_str_buffer[14]=35;
cas_str_buffer[13]=182;
cas_str_buffer[12]=236;
cas_str_buffer[11]=43;
cas_str_buffer[10]=41;
cas_str_buffer[9]=53;
cas_str_buffer[8]=18;
cas_str_buffer[7]=226;
cas_str_buffer[6]=215;
cas_str_buffer[5]=24;
cas_str_buffer[4]=117;
cas_str_buffer[3]=35;
cas_str_buffer[2]=201;
cas_str_buffer[1]=52;
cas_str_buffer[0]=17;
strcpy(src_str,string.c_str());
for ( i=0;i<strlen(src_str);i++)
{
for(j=0;j<strlen(cas_str);j++)
{
if (src_str[i]==cas_str[j]){
if(i<16)
cas_eax=cas_str_buffer[i];
else {
x=div(i,16);
cas_eax=cas_str_buffer[x.rem] ;
}
cas_edx=cas_esi+cas_esi*2 ;
cas_eax=cas_eax^cas_edx;
cas_eax=cas_eax^k;
cas_eax=cas_eax+j;
x = div(cas_eax,62);
dec_str[i]=cas_str[x.rem];
cas_edx=x.rem ;
cas_esi=cas_esi^(cas_edx+9433);
break;
}
}
if( dec_str[i]==NULL)
dec_str[i]=src_str[i];
k=k+5;
}
string=dec_str;
return string;
}
void __fastcall TForm1::Button3Click(TObject *Sender)
{
if(Edit2->Text.Length()>0&Edit2->Text.Length()<128)
{
Edit1->Text = DeCode(Edit2->Text);
}else
{
ShowMessage(" 用户名错误 !");
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TForm1::DeCode(AnsiString string)
{
char src_temp[]="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
if(string.SubString(1,2)=="2:")string=string.SubString(3,string.Length()-2);
AnsiString TempString="";
AnsiString TempString1="";
for(int j=0;j<string.Length()+1;j++)
{
for(int i=0;i<62;i++)
{
TempString = TempString1 + AnsiString(src_temp[i]);
if(EnCode(TempString)== string.SubString(1,j))
{
TempString1=TempString;
break;
}
}
}
return TempString1;
}
|