Arcfour encryption algorithm

Hi folks,

I’m looking for a way to use the arc4 encryption algorithm with
RubyOnRails. I have some automatic mails in which there’s links to my
website functions. In these links I want to encode various datas (such
as login, password, identification number…). I did it with Chilkat
and works great but this plugin can only be used with Windows so now
that I deployed my WebSite on linux, well the function using Chilkat
does’t work any more…

Thanks for your help and suggestions (I’ve been looking for another
solution all the day testing various encryption algorithm but can’t
find anything as good as arc4).

Here you have simple implentation in Python, it should be easy to
translate that into ruby

http://en.wikipedia.org/wiki/RC4_(cipher)

m.

On 3 sep, 02:59, edek [email protected] wrote:

Here you have simple implentation in Python, it should be easy to
translate that into ruby

http://en.wikipedia.org/wiki/RC4_(cipher)

m.

I’m gonna have a look at it, thanks :wink:

I’ve been using this implementation for a while. Unfortunately, the
file doesn’t have any author info in it, and I can’t find it in Google
any longer, so I’m not sure who deserves credit for it.

I also make this patch to it:

class ARC4

def setup(key)
#@init_s = Array.new(256) { |i| i }
@init_s = ‘’
0.upto(255) { |i| @init_s << i }
j = 0
for i in 0 … 255
j = (j + @init_s[i] + key[i % key.size]) & 0xff
@init_s[i], @init_s[j] = @init_s[j], @init_s[i]
end
reset
end

def reset
@s = @init_s.dup
@i = 0
@j = 0
end

end

Cheers,
Jim

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs