Want to improve this question? Update the question so it focuses on one problem only by editing this post.
开发者_运维百科Closed 7 years ago.
Improve this questionI want to create a java program in which I will give plain text , a key then the output should be of same length as of plain text. Using the same key I will decrypt the encrypted text. So please suggest me how to proceed?
Thanks.
What sort of encryption scheme are you wanting? The Vigenère cipher will give you ciphertext of the same length as your plaintext, but if the key is not random the ciphertext will be vulnerable to various frequency attacks such as the Kasiski examination.
What are you trying to achieve?
Using a stream cipher like RC4 or a block cipher like AES in a counter mode can do what you want. However, these still require an a random IV for each message so you have to somehow manage that.
精彩评论