Package com.zybooks.dsaj.fundamental
Class CaesarCipher
java.lang.Object
com.zybooks.dsaj.fundamental.CaesarCipher
Class for doing encryption and decryption using the Caesar Cipher.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCaesarCipher
(int rotation) Constructor that initializes the encryption and decryption arrays. -
Method Summary
-
Field Details
-
encoder
protected char[] encoder -
decoder
protected char[] decoder
-
-
Constructor Details
-
CaesarCipher
public CaesarCipher(int rotation) Constructor that initializes the encryption and decryption arrays.- Parameters:
rotation
- the amount of forward shift
-
-
Method Details
-
encrypt
Returns an encrypted version of an original message.- Parameters:
message
- the original message- Returns:
- the encrypted message
-
decrypt
Returns a decrypted message, given the encrypted secret.- Parameters:
secret
- the encrypted message- Returns:
- the original (unencrypted) message
-
main
Simple main method for testing the Caesar cipher
-