From e057344ead452694fdc5b986a5caf9bcc30bc643 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sun, 31 Mar 2019 00:37:49 -0400 Subject: [PATCH] Added the beginings of all classes and functions Nothing is currently implemented --- Atbash.py | 45 ++++++++++++++++++++++++ Autokey.py | 39 +++++++++++++++++++++ Caesar.py | 53 +++++++++++++++++++++++++++++ Morse.py | 50 +++++++++++++++++++++++++++ Playfair.py | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Vigenere.py | 60 ++++++++++++++++++++++++++++++++ 6 files changed, 345 insertions(+) create mode 100644 Atbash.py create mode 100644 Autokey.py create mode 100644 Caesar.py create mode 100644 Morse.py create mode 100644 Playfair.py create mode 100644 Vigenere.py diff --git a/Atbash.py b/Atbash.py new file mode 100644 index 0000000..c72af2f --- /dev/null +++ b/Atbash.py @@ -0,0 +1,45 @@ +#PypherStream/Atbash.py +#Matthew Ellison +# Created: 03-30-19 +#Modified: 03-30-19 +#This file contains the Atbash class for the PypherStream Project. +#This class takes input and uses a Atbash Cipher to encode or decode a message. +#This is a Python port of the CipherStream program found at https://bitbucket.org/Mattrixwv/CipherStream + + +class Atbash: + __version = "1.0" #The version of the library + def __init__(self): + self.__inputString = "" #Holds the sting that needs encoded or decoded + self.__outputString = "" #Holds the encoded/decoded string + #Decodes inputString and stores in outputString + def __decode(self) -> str: + NotImplemented + #Encodes inputString and stores in outputSting + def __encode(self) -> str: + NotImplemented + #Removes all invalid characters + def __setInputString(self, input: str): + NotImplemented + #Returns the inputString + def getInputString(self) -> str: + NotImplemented + #Returns the outputString + def getOutputString(self) -> str: + NotImplemented + #Takes the input string and encodes it, returning the new message + def encode(self, imput: str) -> str: + NotImplemented + #Takes the input string and decodes it, returning the new message + def decode(self, input: str) -> str: + NotImplemented + #Makes sure all elements are empty + def reset(self): + NotImplemented + #Returns the version of the library + def getVersion(self) -> str: + NotImplemented + +#This will run the appropriate commands if this script is called stand alone instead of with the rest of the PypherStream program +if __name__ == "__main__": + NotImplemented diff --git a/Autokey.py b/Autokey.py new file mode 100644 index 0000000..2a54f5f --- /dev/null +++ b/Autokey.py @@ -0,0 +1,39 @@ +#PypherStream/Autokey.py +#Matthew Ellison +# Created: 03-30-19 +#Modified: 03-30-19 +#This file contains the Autokey class for the PypherStream Project. +#This class takes input and uses a Autokey Cipher to encode or decode a message. +#This is a Python port of the CipherStream program found at https://bitbucket.org/Mattrixwv/CipherStream + + +from Vigenere import Vigenere + + +class Autokey(Vigenere): + __version = "1.0" #The version of the library + def __init__(self): + NotImplemented + #Special rules for setting the strings for encoding + def __encodeSet(self, key: str, input: str): + NotImplemented + #Setting the strings for decoding + def __decodeSet(self, key: str, input: str): + NotImplemented + #Decodes the inputString + def __decode(self) -> str: + NotImplemented + #Encodes inputString using the Autokey cipher + def encode(self, key: str, input: str) -> str: + NotImplemented + #Decodes inputString using the Autokey cipher + def decode(self, key: str, input: str) -> str: + NotImplemented + #Returns the version number of the library + @classmethod + def getVersion(self): + NotImplemented + +#This will run the appropriate commands if this script is called stand alone instead of with the rest of the PypherStream program +if __name__ == "__main__": + NotImplemented diff --git a/Caesar.py b/Caesar.py new file mode 100644 index 0000000..5ce2022 --- /dev/null +++ b/Caesar.py @@ -0,0 +1,53 @@ +#PypherStream/Caesar.py +#Matthew Ellison +# Created: 03-30-19 +#Modified: 03-30-19 +#This file contains the Caesar class for the PypherStream Project. +#This class takes input and uses a Caesar Cipher to encode or decode a message. +#This is a Python port of the CipherStream program found at https://bitbucket.org/Mattrixwv/CipherStream + + +class Caesar: + __version = "1.0" #The current version number for the library + def __init__(self): + self.__inputString = "" #The string that needs encoded/decoded + self.__outputString = "" #The encoded/decoded string + self.__shift = 0 #The amount that you need to shift each letter + #Sets shift and makes sure it is within the propper bounds + def __setShift(self, shiftAmount: int): + NotImplemented + #Sets the input string + def __setInputString(self, inputString: str): + NotImplemented + #Encodes the inputString and stores the result in outputString + def __encode(self) -> str: + NotImplemented + #Decodes the inputString and stores the result in outputString + def __decode(self) -> str: + NotImplemented + #Returns the inputString + def getInputString(self) -> str: + NotImplemented + #Returns the shift value + def getShift(self) -> int: + NotImplemented + #Returns the outputString + def getOutputString(self) -> str: + NotImplemented + #Sets the shift and inputString and encodes the message + def encode(self, shiftAmount: int, input: str) -> str: + NotImplemented + #Sets the shift and inputString and decodes the message + def decode(self, shiftAmount: int, input: str) -> str: + NotImplemented + #Makes sure all of the variables are empty + def reset(self): + NotImplemented + #Returns the version of the library + @classmethod + def getVersion(cls) -> str: + NotImplemented + +#This will run the appropriate commands if this script is called stand alone instead of with the rest of the PypherStream program +if __name__ == "__main__": + NotImplemented diff --git a/Morse.py b/Morse.py new file mode 100644 index 0000000..a3436e9 --- /dev/null +++ b/Morse.py @@ -0,0 +1,50 @@ +#PypherStream/Morse.py +#Matthew Ellison +# Created: 03-30-19 +#Modified: 03-30-19 +#This file contains the Morse class for the PypherStream Project. +#This class takes input and uses a Morse Cipher to encode or decode a message. +#This is a Python port of the CipherStream program found at https://bitbucket.org/Mattrixwv/CipherStream + + +class Morse: + __version = "1.0" + __code = [""] #Holds the Morse representation of the alphanumeric characters + def __init__(self): + self.__inputString = "" #The string that needs encoded/decoded + self.__outputString = "" #The encoded/decoded message + #Encodes inputString snd stores the result in outputString + def __encode(self) -> str: + NotImplemented + #Decodes inputString snd stores the result in outputString + def __decode(self) -> str: + NotImplemented + #Encodes input and returns the result + def __setEncodeInputString(self, input: str): + NotImplemented + #Decodes input and returns the result + def __setDecodeInputString(self, input: str): + NotImplemented + #Returns inputString + def getInputString(self) -> str: + NotImplemented + #Returns outputString + def getOutputString(self) -> str: + NotImplemented + #Encodes input and returns the result + def encode(self, input: str) -> str: + NotImplemented + #Decodes input and returns the result + def decode(self, input: str) -> str: + NotImplemented + #Makes sure all variables are empty + def reset(self): + NotImplemented + #Returns the version of the library + @classmethod + def getVersion(cls) -> str: + NotImplemented + +#This will run the appropriate commands if this script is called stand alone instead of with the rest of the PypherStream program +if __name__ == "__main__": + NotImplemented diff --git a/Playfair.py b/Playfair.py new file mode 100644 index 0000000..f883b67 --- /dev/null +++ b/Playfair.py @@ -0,0 +1,98 @@ +#PypherStream/Playfair.py +#Matthew Ellison +# Created: 03-30-19 +#Modified: 03-30-19 +#This file contains the Playfair class for the PypherStream Project. +#This class takes input and uses a Playfair Cipher to encode or decode a message. +#This is a Python port of the CipherStream program found at https://bitbucket.org/Mattrixwv/CipherStream + + +class Playfair: + __replaced = "" #The letter that will need to be replaced in the grid and any input string or keyword + __replacer = "" #The letter that replaced __replaced in any input string or keyword + __doubled = "" #The letter that will be placed between double letters in the input string if necessary or to make the string length even + __version = "1.0" #The current library's version number + __grid: str = [["", "", "", "", ""], + ["", "", "", "", ""], + ["", "", "", "", ""], + ["", "", "", "", ""], + ["", "", "", "", ""]] + def __init__(self): + self.__inputString = "" #The message that needs to be encoded/decoded + self.__outputString = "" #The encoded/decoded message + self.__keyword = "" #The keyword used to create the grid + #Create the grid from the keyword + def __createGrid(self): + NotImplemented + #Returns true if the letter is found in the grid + def __checkGrid(self, letter: str) -> bool: + NotImplemented + #Searches the grid for letter and sets row & col to its location in grid + def __searchGrid(self, letter: str, row: int, col: int) -> int: + NotImplemented + #Strips invalid characters from the string that needs encoded/decoded + def __setInputString(self, input: str): + NotImplemented + #Strips invalid characters from the keyword and creates the grid + def __setKeyword(self, key: str): + NotImplemented + #Encodes inputString using the PLayfair cipher and stores the results in outputString + def __encode(self) -> str: + NotImplemented + #Decodes inputString using the PLayfair cipher and stores the results in outputString + def __decode(self) -> str: + NotImplemented + #Sets the keyword and inputString and encodes the message + def encode(self, keyword: str, input: str) -> str: + NotImplemented + #Sets the keyword and inputString and decodes the message + def decode(self, keyword: str, input: str) -> str: + NotImplemented + #Returns the keyword used to create the grid + def getKeyword(self) -> str: + NotImplemented + #Returns the string that needs encoded/decoded + def getInputString(self) -> str: + NotImplemented + #Returns the encoded/decoded message + def getOutputString(self) -> str: + NotImplemented + #Returns a string representation of the grid + def getGrid(self) -> str: + NotImplemented + #Makes sure all variables are empty + def reset(self): + NotImplemented + #Allow accessing and modifying of class variables + #Returns the character that needs replaced in messages and the grid + @classmethod + def getReplaced(cls) -> str: + NotImplemented + #Returns the character that replaces the character that needs replaced + @classmethod + def getReplacer(cls) -> str: + NotImplemented + #Returns the character that is added between 2 adjacent characters that are the same + @classmethod + def getDoubled(cls) -> str: + NotImplemented + #Sets the character that needs replaced in messages and the grid + @classmethod + def setReplaced(cls, replaced: str): + NotImplemented + #Sets the character that replaces the character that needs replaced + @classmethod + def setReplacer(cls, replacer: str): + NotImplemented + #Sets the character that is added betwee 2 adjacent characters that are the same + @classmethod + def setDoubled(cls, doubled: str): + NotImplemented + #Returns the current version of the library + @classmethod + def getVersion(cls) -> str: + NotImplemented + +#This will run the appropriate commands if this script is called stand alone instead of with the rest of the PypherStream program +if __name__ == "__main__": + NotImplemented diff --git a/Vigenere.py b/Vigenere.py new file mode 100644 index 0000000..9e5e24c --- /dev/null +++ b/Vigenere.py @@ -0,0 +1,60 @@ +#PypherStream/Vigenere.py +#Matthew Ellison +# Created: 03-30-19 +#Modified: 03-30-19 +#This file contains the Vigenere class for the PypherStream Project. +#This class takes input and uses a Vigenere Cipher to encode or decode a message. +#This is a Python port of the CipherStream program found at https://bitbucket.org/Mattrixwv/CipherStream + + +class Vigenere: + __version = "1.0" #The current library's version number + def __init__(self): + self.__inputString = "" #This is the string that you want to encode or decode + self.__outputString = "" #This is the string that is output from encoding or decoding + self.__keyword = "" #This is the keyword that is the resposible for determining the offsets that you change each character by + self.__offset = [] #This holds the offsets computed from each character in the keyword + #Uses keyword to calculate the offset for the Caesar cipher for each character + def __setOffset(self): + NotImplemented + #Sets inputString + def __setInputString(self, input: str): + NotImplemented + #Sets keyword + def __setKeyword(self, key: str): + NotImplemented + #Encodes inputString and stores the result in outputString + def __encode(self) -> str: + NotImplemented + #Decodes inputString and stores the result in outputString + def __decode(self) -> str: + NotImplemented + #Returns the current inputString + def getInputString(self) -> str: + NotImplemented + #Returns the current outputString + def getOutputString(self) -> str: + NotImplemented + #Returns the current keyword + def getKeyword(self) -> str: + NotImplemented + #Returns the current offsets (Used mostly in bug fixing) + def getOffsets(self) -> list: + NotImplemented + #Encodes input using key and returns the result + def encode(self, key: str, input: str) -> str: + NotImplemented + #Decodes input usig key and returns the result + def decode(self, key: str, input: str) -> str: + NotImplemented + #Makes sure all of the variables are empty + def reset(self): + NotImplemented + #Returns the current version of the library + @classmethod + def getVersion(self) -> str: + NotImplemented + +#This will run the appropriate commands if this script is called stand alone instead of with the rest of the PypherStream program +if __name__ == "__main__": + NotImplemented