RUBY - Decrypter for simple encrypter





1
Date Submitted Mon. Jun. 9th, 2008 3:56 AM
Revision 1 of 1
Helper jamesmcm
Tags decryption | Ruby
Comments 0 comments
The decrypter for the simple encrypter I posted earlier - Takes the encrypted text from a text file - "encrypt.txt" which the encrypter automatically writes to.

File.open('encrypt.txt', 'r') do |f1| 
  n=0
   while line = f1.gets 
      text=line
         
        end
text2=text.split(",")
text3=Array.new
while n<text2.length
text3[n]=text2[n].to_i
n=n+1
end
n=0
text4=Array.new

while n<text2.length
text4[n]=text3[n] - ((n*n*n)+(n*n)+n+text2.length)
n=n+1
end
n=0
text5=Array.new
while n<text2.length
text5[n]=text4[n].chr
n=n+1
end

text6=text5.join

File.open('decrypt.txt', 'w') do |f2|
  f2.puts text6
end

   end
 

james mcm

Comments

There are currently no comments for this snippet.

Voting

Votes Up


Helper jamesmcm

Votes Down