RC4 implementation (was Re: Base64 conversion)

Mark Smith mark at maseurope.net
Tue Jul 10 10:12:38 CDT 2007

Yes, the output is just a string of bytes (chars). In use, one would  
probaly want to base64Encode it for transmission over the net, or  
show the hex numbers.

I did test using the test vectors at


and got the right results, by converting to hex using this function:

function binToHex pString
   repeat for each char c in pString
     get charToNum(c)
     put baseConvert(it,10,16) into tTemp
     if it < 16 then put "0" before tTemp
     put tTemp after tHex
   end repeat
   return tHex
end binToHex



ps. of course, you must convert the test inputs and keys to bytes in  
order to test.

On 10 Jul 2007, at 15:59, Ken Ray wrote:

> On Tue, 10 Jul 2007 11:06:48 +0100, Mark Smith wrote:
>> Here it is - an RC4 implementation in for Revolution:
> Thanks, Mark! But I ran your code using the test vectors at the
> Wikipedia site (http://en.wikipedia.org/wiki/RC4) and I don't get the
> same results that they identify you should get - I think you may need
> to convert the result to hex?
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

More information about the use-livecode mailing list