This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Vigenere encryption proplem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Vigenere encryption proplem" Watch "Vigenere encryption proplem" New topic
Author

Vigenere encryption proplem

hadeel marghlany
Greenhorn

Joined: Feb 21, 2013
Posts: 12

am trying to do a Vigenere java program put the cipher text in the output apears empty

this is my class




this is my mean



and this is the output

pleas enter your plain text
hadeel
pleas enter your key
aa
the chiper text is:

Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7553
    
  18

hadeel marghlany wrote:am trying to do a Vigenere java program put the cipher text in the output apears empty

Well, my first suggestion would be to break up that awful
cipher = cipher+ letter.charAt((letter.indexOf (key.charAt(j)+letter.indexOf (message.charAt(j)))) %26);
line into something more readable.

I'm also not quite sure why you're using indexOf(). A Vignere cypher should use direct indexes, not searches.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
Don't get me started about those stupid light bulbs.
 
subject: Vigenere encryption proplem
 
Similar Threads
javax.crypto.BadPaddingException: Given final block not properly padded
Unusual behavior of Simple Cipher Program
the out put is wrong in my encryption code
caesar decryption proplem
crytography