Jump to content

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 80
  • Created
  • Last Reply

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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.