PDA

View Full Version : Java Text Encryptor. (It is a fail >.>)



mrpickle
01-11-2010, 06:00 PM
Ok, for the file encrytor I got the main part fixed. People are awsome and helped me :).




I've tested this. It works on Eclipse. Tried it on Ready To Program Java. It fails. I have to make this work on RTP. RTP hates the load part.



Put both files in a folder called "Design" without quotes. Manipulate the save on Main to encrypt whatever other Stiring you like. Very simple encryption & decruption +1 - 1 values.

Nadeem
01-11-2010, 11:44 PM
If you really are doing you CharConvert like that, it can simply be like:

char CharConvert(char c) { return (char)((byte)c+1); }

As for your file reader, you could've just simply just googled and got enough tutorials and help quick ;) (heres a good one: http://www.javapractices.com/topic/TopicAction.do?Id=42)


~NS

Wizzup?
01-12-2010, 04:16 PM
If you really are doing you CharConvert like that, it can simply be like:

char CharConvert(char c) { return (char)((byte)c+1); }

As for your file reader, you could've just simply just googled and got enough tutorials and help quick ;) (heres a good one: http://www.javapractices.com/topic/TopicAction.do?Id=42)


~NS

A char in java is 16 bits, so you shouldn't cast it to a byte. (Yeah, it's weird...)


char CharConvert(char c) {
return (c + 1) & 65535;
}

mrpickle
01-12-2010, 05:19 PM
Ok, I got this working on Eclipse after hours of struggling.

Getting it to work on RTP is a different story...




And thanks for the suggestions. I changed to the value manipulation method. Learned a bunch of new commands in the process.

arash
01-13-2010, 11:33 PM
Why do you use BufferedReader when reading from a text file, just use scanner. It is much less resource intensive.

mrpickle
01-14-2010, 03:30 AM
Well, the reading method I learned first is BufferedReader, and I used where what I am most familiar with. Scanner I have not yet tried it.