Home > Back-end >  Who is a great god will c #, help to translated into Delphi, thank you!
Who is a great god will c #, help to translated into Delphi, thank you!

Time:09-17

The class Util
{
Private const int PWD_DATA_SIZE=40;
Public static byte [] getPWD (string PWD)
{
//PWD_HS1: IDC_HS1:;
Byte [] BPWD=new byte [PWD_DATA_SIZE];
Byte [] head=Encoding. The ASCII. GetBytes (" PWD_HS1: ");
Byte [] SPWD=Encoding. The ASCII. GetBytes (PWD).
Byte [] temp=new byte [32 - SPWD. Length];
Byte [] MPWD=MergerArray (SPWD, temp);
Temp=new byte [32].
Util. FKHS3760_EncryptPwd (ref MPWD, ref temp, 32).
BPWD=MergerArray (head, temp);
Return BPWD;
}

Public static byte [] MergerArray (byte [] First, byte [] Second)
{
Byte [] result=new byte [First. Length + Second. Length].
First. CopyTo (result, 0);
Second, CopyTo (result, First. Length);
return result;
}

Public static void FKHS3760_EncryptPwd (ref byte [] apOrgPwdData, ref byte [] apEncPwdData, int aPwdLen)
{
int i;

GPassEncryptKey=12415;
for (i=0; I & lt; APwdLen; I++)
ApEncPwdData [I]=Encrypt_1Byte (apOrgPwdData [I]);
}

Public static int gPassEncryptKey;
Public static byte Encrypt_1Byte (byte aByteData)
{
Int U0=28904;
Int U1=35756;
Byte vCrytData;

VCrytData=https://bbs.csdn.net/topics/(byte) (aByteData ^ (byte) (gPassEncryptKey> 8));
GPassEncryptKey=(vCrytData + gPassEncryptKey) * U0 + U1.
Return vCrytData;
}

Public static void FKHS3760_DecryptPwd (byte [] apEncPwdData, ref byte [] apOrgPwdData, int aPwdLen)
{
int i;

GPassEncryptKey=12415;
for (i=0; I & lt; APwdLen; I++)
ApOrgPwdData [I]=Decrypt_1Byte (apEncPwdData [I]);
}

Public static byte Decrypt_1Byte (byte aByteData)
{
Int U0=28904;
Int U1=35756;
Byte vCrytData;

VCrytData=https://bbs.csdn.net/topics/(byte) (aByteData ^ (byte) (gPassEncryptKey> 8));
GPassEncryptKey=(aByteData + gPassEncryptKey) * U0 + U1.
Return vCrytData;
}
}

CodePudding user response:

Their environment, under the debugging to know, and then rewrite into Delphi,
Too time consuming!

CodePudding user response:

What you don't know what you mean, ask ok!

CodePudding user response:

Is the string into an array of bytes, roughly encryption to decrypt,

  • Related