const
PublicKey=63169;
Modulus=43679;
Function Crypt(const pLngMessage, pLngKey:integer):Integer;
var
lLngMod,lLngResult,lLngIndex:integer;
begin
If pLngKey Mod 2 = 0 Then
begin
lLngResult := 1;
For lLngIndex := 1 To pLngKey div 2 do
begin
lLngMod := round(Power(pLngMessage , 2)) Mod Modulus;
// Mod may error on key generation
lLngResult := (lLngMod * lLngResult) Mod Modulus
end;
end
Else
begin
lLngResult := pLngMessage ;
For lLngIndex := 1 To pLngKey div 2 do
begin
lLngMod := round(Power(pLngMessage , 2)) Mod Modulus ;
// Mod may error on key generation
lLngResult := (lLngMod * lLngResult) Mod Modulus ;
end;
End;
Result := lLngResult ;
End;
Function Encode(const pStrMessage:String):String;
var
lLngIndex,lLngMaxIndex:Integer;
lBytAscii:Byte;
lLngEncrypted:Integer;
begin
Result := '';
lLngMaxIndex := Length(pStrMessage);
If lLngMaxIndex = 0 Then
Exit;
For lLngIndex := 1 To lLngMaxIndex do
begin
lBytAscii := Ord(pStrMessage[lLngIndex]);
lLngEncrypted := Crypt(lBytAscii, PublicKey);
Result := Result + IntToHex(lLngEncrypted, 4)
end;
End;
Procedure Gen2006Key(var st1:String; Const sSiteName,sYear,sVersion:String;iStr:Integer);
var
sSiteMD5,SA,sCRC:String;
i,k:Integer;
begin
SA:='';
sSiteMD5:= cMD5.UpperMD5(cBase64.StrToBase64(sSiteName)+ cBase64.StrToBase64(sVersion));