Giter Club home page Giter Club logo

shiftcipheralgorithm's Introduction

ShiftCipherAlgorithm

This repository highlights the basic shift cipher algorithm that allows users to encrypt and decrypt text.

In the src code folder, we have a single .py file that is used to encrypt/decrypt the algorithm.

Features of the .py code:

  1. Encrypt an inputted text using a chosen key (1 - 25)
  2. Decrypt an inputted text using a chosen key (1 - 25)
  3. Decrypt an inputted text WITHOUT knowing the chosen key. If the key is unknown, the program will use an exhaustive algorithm that checks every possible decryption and prints them out.

Q: Why must the key be within ranges 1 to 25? A: In the shift cipher algorithm, we are attempting to shift every letter in the inputted text by the key amount. For example, given the letter 'A' and the key 2, we would encrypt the letter as 'C' (A - > B - > C) As a result, there are 25 possible UNIQUE shifts. Although you can shift more, they would result in the same number as the original 25. We also don't include 26 as a shift since it would bring us to our original letter (26 letters in the alphabet).

Q: What are some future modifications that can be made to this program? A: In the future, I'd like to implement a library that can read the text from the exhaustive algorithm that would be able to determine if the decryption was a string of proper words! Also, I would like to the encryption to maintain its original caps case. In this simple demonstration, it returns the encryption in only uppercase. I plan to fix this in the future.

PSUEDOCODE:

encrypt(inputString, shift): encryptedText = "" for char in inputString: if checkifalphabetical(char): encryptedText += ord(char) + shift else: encryptdTexed += char return encryptedText

decryptWithKey(inputString, shift): decryptedText = "" for char in inputString: if checkifalphabetical(char): encryptedText += ord(char) - shift else: decryptdTexed += char return decryptedText

decryptWithoutKey(inputString): for i in range(1, 26): oneIteration = "" for char in inputString: if checkifalphabetical(char): oneIteration += ord(char) - i else: oneIteration += char print(oneIteration) return True

shiftcipheralgorithm's People

Contributors

jcng75 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.