Jump to content

Programming Challenge: Caesar Cipher Encoder/Decoder (Jan 12, 2025)

Featured Replies

Posted

Write a program that implements a Caesar Cipher, one of the simplest encryption techniques. The program should be able to both encrypt and decrypt text using a given shift value.

Basic Requirements:

  1. Accept a message from the user.

  2. Accept a shift value (e.g., 3 shifts each letter forward by 3).

  3. Provide options to encrypt or decrypt the message.

  4. Handle both uppercase and lowercase letters.

Bonus Features:

  • Handle non-alphabetic characters by leaving them unchanged.

  • Allow the user to brute-force decrypt a message by trying all possible shift values.

  • Implement a case-insensitive mode to ignore letter casing in the input.

Example Output:

Choose an option: (1) Encrypt (2) Decrypt
> 1
Enter the message: Hello World!
Enter shift value: 3
Encrypted message: Khoor Zruog!

Choose an option: (1) Encrypt (2) Decrypt
> 2
Enter the message: Khoor Zruog!
Enter shift value: 3
Decrypted message: Hello World!
  • Views 168
  • Created
  • Last Reply

Create an account or sign in to comment

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.