Posted March 24, 20169 yr 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.
March 26, 20169 yr 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;
Create an account or sign in to comment