aspose file tools*
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
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: 7801
    
  21

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vigenere encryption proplem