diff --git a/Headers/Atbash.hpp b/Headers/Atbash.hpp index 8656bbf..a82b58b 100644 --- a/Headers/Atbash.hpp +++ b/Headers/Atbash.hpp @@ -1,7 +1,7 @@ //Ciphers/Headers/Atbash.hpp //Matthew Ellison // Created: 4-30-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the declaration of the Atbash class //This class is used to encode and decode an Atbash cipher @@ -15,6 +15,7 @@ class Atbash{ private: std::string inputString; //Holds the string that needs encoded or decoded std::string outputString; //Holds the encoded/decoded string + static const std::string version; //Holds the current version of the library std::string decode(); //Decodes inputString and stores in outputString std::string encode(); //Encodes inputString and stores in outputString void setInputString(std::string input); //Removes all invalid characters and sets inputString @@ -26,6 +27,7 @@ public: std::string encode(std::string input); std::string decode(std::string input); void reset(); + static std::string getVersion(); }; #endif //ATBASH_HPP diff --git a/Headers/Autokey.hpp b/Headers/Autokey.hpp index 774b8a4..6c53854 100644 --- a/Headers/Autokey.hpp +++ b/Headers/Autokey.hpp @@ -1,7 +1,7 @@ //Ciphers/Headers/Autokey.hpp //Matthew Ellison // Created: 5-2-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the declaration of the Autokey class //This class will encode a message using the Autokey cipher @@ -22,6 +22,7 @@ public: ~Autokey(); virtual std::string encode(std::string key, std::string input); //Encodes inputString using the Autokey cipher virtual std::string decode(std::string key, std::string input); //Decodes inputString using the Autokey cipher + static std::string getVersion(); }; diff --git a/Headers/Caesar.hpp b/Headers/Caesar.hpp index 040bde3..0f92af3 100644 --- a/Headers/Caesar.hpp +++ b/Headers/Caesar.hpp @@ -1,7 +1,7 @@ //Ciphers/Headers/Caesar.hpp //Matthew Ellison // Created: 4-25-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the declaration of the Caesar class //This class implements the Caesar Cipher and is inteded to be turned into a library @@ -15,6 +15,7 @@ class Caesar{ private: std::string inputString; //The string that needs encoded/decoded std::string outputString; //The encoded/decoded string + static const std::string version; //The current version number for the library int shift; //The amount that you need to shift each letter void setShift(int shiftAmount); //Sets shift and makes sure it is within the propper bounds void setInputString(std::string inputString); //Sets the input string @@ -29,6 +30,7 @@ public: std::string encode(int shiftAmount, std::string input); //Sets the shift and inputString and encodes the message std::string decode(int shiftAmount, std::string input); //Sets the shift and inputString and decodes the message void reset(); //Makes sure all of the variables are empty + static std::string getVersion(); }; diff --git a/Headers/Morse.hpp b/Headers/Morse.hpp index da78e0a..4d5fda6 100644 --- a/Headers/Morse.hpp +++ b/Headers/Morse.hpp @@ -1,7 +1,7 @@ //Ciphers/Headers/Morse.hpp //Matthew Ellison // Created: 5-1-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the declaration of the Morse class //This class is designed to translate Morse Code into regular letters and numbers @@ -15,11 +15,10 @@ class Morse{ private: //Holds the Morse representation of the alphanumeric characters - const std::string code[36] {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", //A-L - "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", //M-Z - "-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----."}; //0-9 + static const std::string code[]; std::stringstream inputString; //The string that needs encoded/decoded std::string outputString; //The encoded/decoded message + static const std::string version; //The current library's version number std::string encode(); //Encodes inputString and stores the result in outputString std::string decode(); //Decodes inputString and stores the result in outputString void setEncodeInputString(std::string input); //Encodes input and returns the result @@ -32,6 +31,7 @@ public: std::string encode(std::string input); //Encodes input and returns the result std::string decode(std::string input); //Decodes input and returns the result void reset(); //Makes sure all variables are empty + static std::string getVersion(); }; #endif //MORSE_HPP \ No newline at end of file diff --git a/Headers/Playfair.hpp b/Headers/Playfair.hpp index 6a7d60c..86f3e37 100644 --- a/Headers/Playfair.hpp +++ b/Headers/Playfair.hpp @@ -1,7 +1,7 @@ //Ciphers/Headers/Playfair.hpp //Matthew Ellison // Created: 4-25-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the declaration of the Playfair class //It is designed to encrypt and decrypt strings using the Playfair cipher @@ -20,6 +20,7 @@ private: std::string inputString; //The message that needs to be encoded/decoded std::string outputString; //The encoded/decoded message std::string keyword; //The keyword used to create the grid + static const std::string version; //The current library's version number char grid[5][5]; //The grid used to encode/decode the message void createGrid(); //Create the grid from the keyword bool checkGrid(const char letter) const; //Returns true if the letter is found in the grid @@ -45,6 +46,7 @@ public: static void setReplaced(const char replaced); //Sets the character that needs replaced in messages and the grid static void setReplacer(const char replacer); //Sets the character that replaces the character that needs replaced static void setDoubled(const char doubled); //Sets the character that is added betwee 2 adjacent characters that are the same + static std::string getVersion(); }; #endif //PLAYFAIR_HPP diff --git a/Headers/Vigenere.hpp b/Headers/Vigenere.hpp index d0c70be..2d6f002 100644 --- a/Headers/Vigenere.hpp +++ b/Headers/Vigenere.hpp @@ -1,7 +1,7 @@ //Ciphers/SourceFiles/Vigenere.hpp //Matthew Ellison // Created: 4-29-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the declaration of the Vigenere class #ifndef VIGENERE_HPP @@ -17,6 +17,7 @@ protected: std::string inputString; //This is the string that you want to encode or decode std::string outputString; //This is the string that is output from encoding or decoding std::string keyword; //This is the keyword that is the resposible for determining the offsets that you change each character by + static const std::string version; //The current library's version number std::vector offset; //This holds the offsets computed from each character in the keyword void setOffset(); //Uses keyword to calculate the offset for the Caesar cipher for each character void setInputString(std::string input); //Sets inputString @@ -33,6 +34,7 @@ public: std::string encode(std::string key, std::string input); //Encodes input using key and returns the result std::string decode(std::string key, std::string input); //Decodes input using key and returns the result void reset(); //Makes sure all of the variables are empty + static std::string getVersion(); }; #endif //VIGENERE_HPP diff --git a/SourceFiles/Atbash.cpp b/SourceFiles/Atbash.cpp index 2189531..af372b1 100644 --- a/SourceFiles/Atbash.cpp +++ b/SourceFiles/Atbash.cpp @@ -1,13 +1,20 @@ //Ciphers/SourceFiles/Atbash.cpp //Matthew Ellison // Created: 4-30-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the implementation of the Atbash class #include "../Headers/Atbash.hpp" #include + +/** + * @brief The current library's version number + * + */ +const std::string Atbash::version = "1.0"; + /** * @brief Construct a new Atbash object * @@ -121,3 +128,12 @@ std::string Atbash::decode(std::string input){ void Atbash::reset(){ inputString = outputString = ""; } + +/** + * @brief Returns a string containing the version information + * + * @return The version information + */ +std::string Atbash::getVersion(){ + return version; +} diff --git a/SourceFiles/Autokey.cpp b/SourceFiles/Autokey.cpp index aa487e2..c61cbf3 100644 --- a/SourceFiles/Autokey.cpp +++ b/SourceFiles/Autokey.cpp @@ -1,7 +1,7 @@ //Ciphers/SourceFiles/Autokey.cpp //Matthew Ellison // Created: 5-3-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the implementation of the Autokey class @@ -9,6 +9,12 @@ #include +/** + * @brief The current library's version number + * + */ +const std::string Vigenere::version = "1.0"; + /** * @brief Construct a new Autokey object * @@ -137,4 +143,13 @@ std::string Autokey::decode(std::string key, std::string input){ setInputString(input); decodeSet(key, input); //Decoding is a bit different because part of the key is also part of the original message return Autokey::decode(); -} \ No newline at end of file +} + +/** + * @brief Returns a string containing the version information + * + * @return The version information + */ +std::string Autokey::getVersion(){ + return version; +} diff --git a/SourceFiles/Caesar.cpp b/SourceFiles/Caesar.cpp index 7f181ab..2edea83 100644 --- a/SourceFiles/Caesar.cpp +++ b/SourceFiles/Caesar.cpp @@ -1,7 +1,7 @@ //Ciphers/SourceFiles/Caesar.hpp //Matthew Ellison // Created: 4-25-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the implementation of the Caesar class //This class implements the Caesar Cipher and is inteded to be turned into a library @@ -11,6 +11,12 @@ #include +/** + * @brief The current library's version number + * + */ +const std::string Caesar::version = "1.0"; + /** * @brief Construct a new Caesar:: Caesar object * @@ -182,3 +188,12 @@ void Caesar::reset(){ inputString = outputString = ""; shift = 0; } + +/** + * @brief Returns a string containing the version information + * + * @return The version information + */ +std::string Caesar::getVersion(){ + return version; +} diff --git a/SourceFiles/Morse.cpp b/SourceFiles/Morse.cpp index b6ab55e..3723ddc 100644 --- a/SourceFiles/Morse.cpp +++ b/SourceFiles/Morse.cpp @@ -1,7 +1,7 @@ //Ciphers/SourceFiles/Morse.cpp //Matthew Ellison // Created: 5-1-18 -//Modified: 5-1-18 +//Modified: 5-16-18 //This file contains the implementation of the Morse class @@ -10,6 +10,20 @@ #include +/** + * @brief The current library's version number + * + */ +const std::string Morse::version = "1.0"; + +/** + * @brief The dot-dash representation of the alphabet and numbers + * + */ +const std::string Morse::code[] {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", //A-L + "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", //M-Z + "-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----."}; //0-9 + /** * @brief Construct a new Morse object * @@ -187,3 +201,12 @@ void Morse::reset(){ inputString.str(""); outputString = ""; } + +/** + * @brief Returns a string containing the version information + * + * @return The version information + */ +std::string Morse::getVersion(){ + return version; +} diff --git a/SourceFiles/Playfair.cpp b/SourceFiles/Playfair.cpp index 808cd64..feabf31 100644 --- a/SourceFiles/Playfair.cpp +++ b/SourceFiles/Playfair.cpp @@ -1,7 +1,7 @@ //Ciphers/Headers/Playfair.cpp //Matthew Ellison // Created: 4-25-18 -//Modified: 5-5-18 +//Modified: 5-16-18 //This file contains the implementation of the Playfair class //It is designed to encrypt and decrypt strings using the Playfair cipher @@ -11,6 +11,12 @@ #include +/** + * @brief The current library's version number + * + */ +const std::string Playfair::version = "1.0"; + ///The letter that needs replaced for the cipher to work char Playfair::REPLACED = 'J'; ///The letter that replaces REPLACED @@ -509,3 +515,12 @@ void Playfair::setDoubled(const char doubled){ DOUBLED = toupper(doubled); } } + +/** + * @brief Returns a string containing the version information + * + * @return The version information + */ +std::string Playfair::getVersion(){ + return version; +} diff --git a/SourceFiles/Vigenere.cpp b/SourceFiles/Vigenere.cpp index b7d2bfd..f8d6fb6 100644 --- a/SourceFiles/Vigenere.cpp +++ b/SourceFiles/Vigenere.cpp @@ -1,7 +1,7 @@ //Ciphers/SourceFiles/Vigenere.cpp //Matthew Ellison // Created: 4-29-18 -//Modified; 5-5-18 +//Modified: 5-16-18 //This file contains the implementation of the Vigenere class #include "../Headers/Vigenere.hpp" @@ -10,6 +10,12 @@ #include +/** + * @brief The current library's version number + * + */ +const std::string Vigenere::version = "1.0"; + /** * @brief Construct a new Vigenere object * @@ -212,3 +218,12 @@ void Vigenere::reset(){ inputString = outputString = keyword = ""; offset.clear(); } + +/** + * @brief Returns a string containing the version information + * + * @return The version information + */ +std::string Vigenere::getVersion(){ + return version; +}