PHP translation needed



Hi Everyone,

We have an encryption function that was written in another language that we
needed translated to PHP.

Here's the function:

function rc4 pText, pKey
-- initialize
repeat with i = 0 to 255
put i into S1[i]
end repeat

put 0 into i
repeat with n = 0 to 255
add 1 to i
if i > length(pkey) then put 1 into i
put chartonum(char i of pKey) into S2[n]
end repeat

put 0 into j
repeat with i = 0 to 255
put (j + S1[i] + S2[i]) mod 256 into j
put S1[i] into temp
put S1[j] into S1[i]
put temp into S1[j]
end repeat

-- encrypt/decrypt
put 0 into i ; put 0 into j
repeat for each char c in pText
put chartonum(c) into tChar

put (i + 1) mod 256 into i
put (j + S1[i]) mod 256 into j
put S1[i] into temp
put S1[j] into S1[i]
put temp into S1[j]
put (S1[i] + S1[j]) mod 256 into t
put S1[t] into K

put numtochar(tChar bitXor K) after tOutput
end repeat

return tOutput
end rc4

Can anyone help us with this? We don't mind paying via PayPal :)

Thanks!
grace


Relevant Pages

  • Re: Monster of a formula!!
    ... The first three columns repeat themselves in the last three. ... Dim FirstAdr As String ... Dim i As Long, temp As Long ... CkID = "Good" ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Select question
    ... I don't have presentation layer at all. ... creating view is always the best solution when you have to repeat the ... derived table or is it faster to repeat the subquery? ... > Other alternatives would involve temp tables, ...
    (microsoft.public.sqlserver.programming)
  • Re: Spotlight and /Volumes
    ... set targ to choose from list with multiple selections allowed -- wrapped if targ is false then error number -128 set pw to text returned of -- wrapped set stats to ... set scpt to "mdutil -s /volumes/" repeat with aDisk in targ set temp to quoted form of contents of aDisk set end of stats to -- wrapped end repeat ...
    (comp.sys.mac.system)
  • Re: [PHP] PHP translation needed
    ... repeat with i = 0 to 255 ... put chartonum(char i of pKey) into S2 ... put S1into temp ...
    (php.general)
  • Mail Merge issue
    ... Hi Friends, I have a question and wondering if anybody out there can ... merge with that temp table. ... Rest of the fields should repeat ... I have a word document and i have done everything that needs to be done ...
    (microsoft.public.access.forms)