From charlesreid1

m (Replacing charlesreid1.com:3000 with git.charlesreid1.com)
 
Line 7: Line 7:
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:
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
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.
Note, however, that in Java a String is just a char array, so any algorithm using a String ends up using an array.

Latest revision as of 03:15, 9 October 2019

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