Here it is - an RC4 implementation in for Revolution:

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


Best,

Mark

On 9 Jul 2007, at 23:54, Mark Smith wrote:

Javier, there's a complete implementation (in pascal, I think) here:

http://www.4guysfromrolla.com/webtech/code/rc4.inc.html

It looks like it would be quite doable in Revolution.

The only bit-twiddling seems to be an xor - see bitXor in the docs.

Best,

Mark

On 9 Jul 2007, at 22:44, Javier Miranda V. wrote:

Yes Ken, I beleive you it's a rich language and being aware of all it's functions, commands and messages may be very difficult. Regarding "RC4", its a propietary encryption algorrithm whose that suddenly appeared published in the internet claiming to be the original code, now the algorithm is known as "Alleged RC4". Im affraid to tell you that I couldn't translate it to transcript, seems to that it uses some byte-level functions, did you see it? There are examples of it's implementation in the 'net.

Saludos, and thank you,

Javier Miranda V.




_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to