I’m implementing a version of the “Mini-AES” (http://findarticles.com/
p/articles/mi_qa3926/is_200210/ai_n9129484) in Ruby and have all of
the bit shifts and stuff working…
The problem I’m having is with the file input. When ever the input
file has the character U+001A (Unicode
char/001a/index.htm), it stops reading in the line (and thus doesn’t
complete the whole cipher text).
Basically, here is the code that I’m using to read the input:
fin = File.open(ARGV[0], ‘r’)
plainText = “”
while (line = fin.gets)
plainText += line
end
fin.close
Here is a sample line of cipher text:
týH†a¤j{ÀìyMšyMÇÜ«àÃSÙ¿àé4þF&käj{Àì
if I read this line in, it would only read “týH†a¤j{ÀìyMšyM” and skip
the rest.
On Mar 17, 12:01 pm, Robert L. [email protected] wrote:
fin = File.open(ARGV[0], ‘r’)
the rest.
I’m using Windows btw.
Robert L. wrote:
On Mar 17, 12:01�pm, Robert L. [email protected] wrote:
fin = File.open(ARGV[0], ‘r’)
the rest.
I’m using Windows btw.
Open the file with “rb” instead of “r”.
On Mar 17, 1:33 pm, Tim H. [email protected] wrote:
Robert L. wrote:
On Mar 17, 12:01 pm, Robert L. [email protected] wrote:
fin = File.open(ARGV[0], ‘r’)
the rest.
I’m using Windows btw.
Open the file with “rb” instead of “r”.
Posted viahttp://www.ruby-forum.com/.
I tried using rb and the output spits out 1/2 plain text and 1/2
random Unicode.
Our project is only allowed to be run on Linux and it seems to work
fine on there, so I’ll just leave the Windows problem alone unless
someone suggests a good fix.