From charlesreid1

(Created page with "=Caesar Cipher= The Caesar cipher is a basic rotation cipher. Each letter of the alphabet is assigned a number. To encrypt, a key (a number between 1 and the size of the alph...")
 
No edit summary
Line 10: Line 10:


Note, however, that in Java a String is just a char array, so any algorithm using a String ends up using an array.
Note, however, that in Java a String is just a char array, so any algorithm using a String ends up using an array.
=Flags=
{{DataStructureFlag}}
[[Category:Java]]
[[Category:Arrays]]
[[Category:Caesar Cipher]]
[[Category:Crypto]]

Revision as of 21:43, 2 June 2017

Caesar Cipher

The Caesar cipher is a basic rotation cipher. Each letter of the alphabet is assigned a number. To encrypt, a key (a number between 1 and the size of the alphabet) is added to the number corresponding to each letter of the plaintext, which gives an integer for the next ciphertext letter. To decrypt, the key is subtracted from each number corresponding to the ciphertext letter to yield the plaintext letter.

No Arrays

This can be done one letter at a time by using String methods and for loops. Here is an implementation that does not explicitly use an Array:

https://charlesreid1.com:3000/charlesreid1/java-crypto/src/master/caesar/Caesar.java

Note, however, that in Java a String is just a char array, so any algorithm using a String ends up using an array.



Flags

Template:DataStructureFlag