Jump to content
Tuts 4 You

Help [PHP to Delphi]


SHKODRAN

Recommended Posts

Hi all members , can someone help me to translate this php code to delphi?

$serialn:='SC-W0VK37682008';
$tSProductID='MODCP2XV94501MB00';
  for ($i = 1; $i <=17; $i++)
  {
    $IDENT_CODE_arr[$i]=(($serialn_arr[$i] ^ $tSProductID_arr[$i]) % 13) + 65;
  }
$IDENT_CODE_arr[18]=50;
 

$sHoldingRegisterState_arr   =  ARRAY(0, 223, 32, 240, 67, 135, 170, 11, 0, 96, 159, 159, 33, 38, 64, 53, 0, 0, 1, 0, 0, 0, 0, 0 );
  for ($i = 1; $i <=17; $i++)
 {
    $tALicenseKey_arr[$i]=$IDENT_CODE_arr[$i] ^ ($sHoldingRegisterState_arr[$i-1] ^ ($i));
    $tALicenseKey_arr[$i]=($tALicenseKey_arr[$i] % 26) + 65;
 }
$tALicenseKey[18]=50;

Thanks in advance.

Best regards. 


 

Link to comment
miketaiston

hello

 

i hope this helps

procedure Calculate;
const
    serialn = 'SC-W0VK37682008';
    tSProductID = 'MODCP2XV94501MB00';
    sHoldingRegisterState :array[0..23] of byte =
        (0, 223, 32, 240, 67, 135, 170, 11, 0, 96, 159,
        159, 33, 38, 64, 53, 0, 0, 1, 0, 0, 0, 0, 0);
var
    IDENT_CODE :array[1..18] of byte;
    tALicenseKey :array[1..18] of byte;
    i :integer;
begin
    for i := 1 to 17 do
        IDENT_CODE[i] := ((ord(serialn[i]) xor ord(tSProductID[i])) mod 13) + 65;
    IDENT_CODE[18] := 50;
    for i := 1 to 17 do
    begin
        tALicenseKey[i] := ord(IDENT_CODE[i]) xor (sHoldingRegisterState[i - 1] xor i);
        tALicenseKey[i] := (tALicenseKey[i] mod 26) + 65;
    end;
    tALicenseKey[18] := 50;
end;

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...