• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vigenere encryption proplem

 
hadeel marghlany
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 10527
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic