Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Program: Simple Caesar Cipher En-/Decoder #365

Open
KnochenMarkSaege opened this issue Feb 4, 2024 · 4 comments
Open

Add Program: Simple Caesar Cipher En-/Decoder #365

KnochenMarkSaege opened this issue Feb 4, 2024 · 4 comments

Comments

@KnochenMarkSaege
Copy link

KnochenMarkSaege commented Feb 4, 2024

As requested in the CONTRIBUTING.md, I'm opening this issue to request a merge for my pull request for my branch "Simple Caesar Cipher En-/Decoder"

I created a little C++ program which encodes & decodes input text by a shit-modifier.
I also included a README.md file that explains how to works.

This Issue is regarding Pull Request #366 .

@K0MPLEXWorksTogether
Copy link

Can I take this up. I already have written some code for this.
Check it out:
https://replit.com/@AbhiramMangipud/Caeser-Cipher
Btw, there are more program's available on my Replit. Ping me if you need anything, or else, use anything you want.
Here's a small preview of my code:

import art
# Printing The Cool ASCII Art.
print(art.logo)

# Maintain A List Of ALl The English Alphabet.
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

def caesar(start_text, shift_amount, cipher_direction):
    # Maintaining End Text.
    end_text = ""

    # Check For Direction Of Cipher.
    if direction == "encode":
      pass
    elif direction == "decode":
      shift_amount *= -1
    else:
      print("You have entered an invalid ciphering direction. Try again.")
      return None

    # Adding Elements To The Cipher Text.
    for letter in start_text:
      if letter in alphabet:
        position = alphabet.index(letter)
        new_position = (position + shift_amount) % 26
        end_text += alphabet[new_position]
      else:
        end_text += letter
    # Displaying Cipher Text.
    print(f"The {cipher_direction}d text is: {end_text}")

# Game Loop.
goAgain = True
while(goAgain):
  direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n")
  text = input("Type your message:\n").lower()
  shift = int(input("Type the shift number:\n"))

  caesar(start_text=text, shift_amount=shift, cipher_direction=direction)

  another_try = input("Enter 'go' if you want to go again. Else enter 'stop'.\n")
  if another_try == 'go':
    pass
  elif another_try == 'stop':
    print("Goodbye Then!")
    goAgain = False
  else:
    print("You have entered invalid choice. Stopping...")
    goAgain = False

@KnochenMarkSaege
Copy link
Author

@K0MPLEXWorksTogether not 100% sure if I'm interpreting your message correctly,
but if you're asking me, if you can use my code for the caesar's cipher:
sure, go ahead.
The second I contributed it to this repo I considered it Open Source, so it's available to be used for everyone who finds it :)

@K0MPLEXWorksTogether
Copy link

I'm so sorry. I didn't know about you opening this issue, to get an approval for your pull request. I thought the issue was up for taking.

@KnochenMarkSaege
Copy link
Author

I think the owner of the repo isn't actively maintaining it anymore.
But you can still feel free to use my code, if you want to, np for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants