Compiled with Seattle...
for newer intraweb version, please note that function: edt_SerialNoChange . There is a serial no range check in intraweb. thats all.
for newer intraweb version, please note that function: edt_SerialNoChange . There is a serial no range check in intraweb. thats all.
PHP Code:
Key functions:
function GenerateLicData(IWLicense: TIWLicense): string;
begin
Result := Format
('Name=%S%SCompany=%S%SDeveloper=%S%SExpiration=%S%SEdition=%S%SSerialNo=%S%SEmail=%S%SHash=%S%S',
[IWLicense.sName, LineBreaker, IWLicense.sCompany, LineBreaker,
IWLicense.sDeveloper, LineBreaker, IWLicense.sExpiration, LineBreaker,
IWLicense.sEdition, LineBreaker, IWLicense.sSerialNo, LineBreaker,
IWLicense.sEmail, LineBreaker, IWLicense.sIDEHash, LineBreaker]);
end;
function EncodeLicense(LicData: string): string;
var
LicRawSplited : array of Byte;
pRawData : PWORD;
nRawDataLen : Word;
nCycle : Integer;
DecNumStr : string;
OddSum, EvenSum, SumHash: Word;
// sTail : string;
begin
// Split the Rawlicense data
nRawDataLen := LicData.Length;
SetLength(LicRawSplited, nRawDataLen * 2);
for nCycle := 1 to nRawDataLen do
begin
pRawData := @LicData[nCycle];
LicRawSplited[(nCycle - 1) * 2] := (pRawData^ and $FF) shr 4;
LicRawSplited[(nCycle - 1) * 2 + 1] := (pRawData^ and $F);
end;
// double the byte
nRawDataLen := nRawDataLen * 2;
for nCycle := 0 to nRawDataLen - 1 do
begin
LicRawSplited[nCycle] := LicRawSplited[nCycle] * 2;
end;
// Expand the Raw data
nRawDataLen := nRawDataLen + 2;
SetLength(LicRawSplited, nRawDataLen);
LicRawSplited[nRawDataLen - 2] := $7;
LicRawSplited[nRawDataLen - 1] := $30;
// Hex To Dec as String
DecNumStr := '';
for nCycle := 0 to nRawDataLen - 1 do
begin
DecNumStr := DecNumStr + Format('%.3d', [LicRawSplited[nCycle]]);
end;
{$IFDEF debug}
CnDebugger.LogMsg(DecNumStr);
{$ENDIF}
// Calc Odd
nCycle := 1;
OddSum := 0;
pRawData := @DecNumStr[nCycle];
while nCycle < DecNumStr.Length do
begin
Inc(OddSum, pRawData^ - $30);
Inc(pRawData, 2);
Inc(nCycle, 2);
end;
{$IFDEF debug}
CnDebugger.LogMsg(IntToHex(OddSum, 8));
{$ENDIF}
// Calc Even
nCycle := 2;
EvenSum := 0;
pRawData := @DecNumStr[nCycle];
while nCycle < DecNumStr.Length do
begin
Inc(EvenSum, pRawData^ - $30);
Inc(pRawData, 2);
Inc(nCycle, 2);
end;
{$IFDEF debug}
CnDebugger.LogMsg(IntToHex(EvenSum, 8));
{$ENDIF}
SumHash := $A - (OddSum * 3 + EvenSum) mod $A;
{$IFDEF debug}
CnDebugger.LogMsg(IntToHex(SumHash, 8));
{$ENDIF}
Result := Copy(DecNumStr, 1, DecNumStr.Length - 1);
Delete(DecNumStr, 1, DecNumStr.Length - 1);
Result := Result + '3' + Format('%.3d', [SumHash]) + '02' + DecNumStr;
{$IFDEF debug}
CnDebugger.LogMsg(Result);
{$ENDIF}
for nCycle := 1 to Result.Length do
begin
pRawData := @Result[nCycle];
pRawData^ := pRawData^ + $11;
Inc(pRawData);
end;
Result := '+0010' + Result;
{$IFDEF debug}
CnDebugger.LogMsg(Result);
{$ENDIF}
end;