From charlesreid1

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://git.charlesreid1.com/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