If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Java Encryptor - strange output

Hey all,

I hope someone can shed some light on this small problem I have. Ok, here goes. I love to do cryptoquotes (or celebrity cyphers, whatever your newspaper calls them) and so does my fiance. I like to send her emails with small cyphers in them but hate having to change all the letters manually.

I thought it would be fun to make a real quick program in java to do this for me, automate the whole process of encrypting and decyphering. I stopped after i made the encryption part because it wasnt outputting what it should have been.

I have attached a zipped folder of the three files i have and at the bottom of cryptoquote.java i have what it does output and what it should output. I also placed some code in the method that encrypts the input string to output each step since i lack a compiler that lets you stop and walk through each line of code.

Please any help on this problem would be greatly appreciated. I know the code is pretty rough but I have yet to refine it all...took me 15 minutes to write it all so I am open to any critiquing.

Hi there, I browsed you code but stopped to find the error. Since you're still in the beginning of your project I think it would be wise to do it a bit different. It's better to work wth char's instead of String's when you're doing this kind of thing.
I attached an example I coded for you. Please bare in mind that there are a lot of flaws in the performance of the encryption, but it's very simple and I think you'll only be using it to encrypt small messages, so you'll be ok. And you can, of course, modify it to your wishes!
It reads and writes the messages and your encryption key from file instead of a console (more conveniet I think).

Do post again if you're having trouble with decrypting messages from your fiance (wish my girlfriend found this interesting...). That's where the real fun begins!

Makes sense now...

Hey thanks, now that you say that it does ring a bell. I have taken quite some time off from coding and I totally forgot about that. Thanks for your help in solving this little problem, from now on I will be sure to check the API just to make sure its not a simple fix like that...haha, i feel silly after reading the solution.