mirror of
https://bitbucket.org/Mattrixwv/cipherstream.git
synced 2025-12-06 18:33:58 -05:00
Added version information for all classes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/Headers/Atbash.hpp
|
//Ciphers/Headers/Atbash.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-30-18
|
// Created: 4-30-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the declaration of the Atbash class
|
//This file contains the declaration of the Atbash class
|
||||||
//This class is used to encode and decode an Atbash cipher
|
//This class is used to encode and decode an Atbash cipher
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ class Atbash{
|
|||||||
private:
|
private:
|
||||||
std::string inputString; //Holds the string that needs encoded or decoded
|
std::string inputString; //Holds the string that needs encoded or decoded
|
||||||
std::string outputString; //Holds the encoded/decoded string
|
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 decode(); //Decodes inputString and stores in outputString
|
||||||
std::string encode(); //Encodes 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
|
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 encode(std::string input);
|
||||||
std::string decode(std::string input);
|
std::string decode(std::string input);
|
||||||
void reset();
|
void reset();
|
||||||
|
static std::string getVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //ATBASH_HPP
|
#endif //ATBASH_HPP
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/Headers/Autokey.hpp
|
//Ciphers/Headers/Autokey.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 5-2-18
|
// Created: 5-2-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the declaration of the Autokey class
|
//This file contains the declaration of the Autokey class
|
||||||
//This class will encode a message using the Autokey cipher
|
//This class will encode a message using the Autokey cipher
|
||||||
|
|
||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
~Autokey();
|
~Autokey();
|
||||||
virtual std::string encode(std::string key, std::string input); //Encodes inputString using the Autokey cipher
|
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
|
virtual std::string decode(std::string key, std::string input); //Decodes inputString using the Autokey cipher
|
||||||
|
static std::string getVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/Headers/Caesar.hpp
|
//Ciphers/Headers/Caesar.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-25-18
|
// Created: 4-25-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the declaration of the Caesar class
|
//This file contains the declaration of the Caesar class
|
||||||
//This class implements the Caesar Cipher and is inteded to be turned into a library
|
//This class implements the Caesar Cipher and is inteded to be turned into a library
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ class Caesar{
|
|||||||
private:
|
private:
|
||||||
std::string inputString; //The string that needs encoded/decoded
|
std::string inputString; //The string that needs encoded/decoded
|
||||||
std::string outputString; //The encoded/decoded string
|
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
|
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 setShift(int shiftAmount); //Sets shift and makes sure it is within the propper bounds
|
||||||
void setInputString(std::string inputString); //Sets the input string
|
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 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
|
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
|
void reset(); //Makes sure all of the variables are empty
|
||||||
|
static std::string getVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/Headers/Morse.hpp
|
//Ciphers/Headers/Morse.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 5-1-18
|
// Created: 5-1-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the declaration of the Morse class
|
//This file contains the declaration of the Morse class
|
||||||
//This class is designed to translate Morse Code into regular letters and numbers
|
//This class is designed to translate Morse Code into regular letters and numbers
|
||||||
|
|
||||||
@@ -15,11 +15,10 @@
|
|||||||
class Morse{
|
class Morse{
|
||||||
private:
|
private:
|
||||||
//Holds the Morse representation of the alphanumeric characters
|
//Holds the Morse representation of the alphanumeric characters
|
||||||
const std::string code[36] {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", //A-L
|
static const std::string code[];
|
||||||
"--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", //M-Z
|
|
||||||
"-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----."}; //0-9
|
|
||||||
std::stringstream inputString; //The string that needs encoded/decoded
|
std::stringstream inputString; //The string that needs encoded/decoded
|
||||||
std::string outputString; //The encoded/decoded message
|
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 encode(); //Encodes inputString and stores the result in outputString
|
||||||
std::string decode(); //Decodes 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
|
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 encode(std::string input); //Encodes input and returns the result
|
||||||
std::string decode(std::string input); //Decodes 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
|
void reset(); //Makes sure all variables are empty
|
||||||
|
static std::string getVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MORSE_HPP
|
#endif //MORSE_HPP
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/Headers/Playfair.hpp
|
//Ciphers/Headers/Playfair.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-25-18
|
// Created: 4-25-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the declaration of the Playfair class
|
//This file contains the declaration of the Playfair class
|
||||||
//It is designed to encrypt and decrypt strings using the Playfair cipher
|
//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 inputString; //The message that needs to be encoded/decoded
|
||||||
std::string outputString; //The encoded/decoded message
|
std::string outputString; //The encoded/decoded message
|
||||||
std::string keyword; //The keyword used to create the grid
|
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
|
char grid[5][5]; //The grid used to encode/decode the message
|
||||||
void createGrid(); //Create the grid from the keyword
|
void createGrid(); //Create the grid from the keyword
|
||||||
bool checkGrid(const char letter) const; //Returns true if the letter is found in the grid
|
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 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 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 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
|
#endif //PLAYFAIR_HPP
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/SourceFiles/Vigenere.hpp
|
//Ciphers/SourceFiles/Vigenere.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-29-18
|
// Created: 4-29-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the declaration of the Vigenere class
|
//This file contains the declaration of the Vigenere class
|
||||||
|
|
||||||
#ifndef VIGENERE_HPP
|
#ifndef VIGENERE_HPP
|
||||||
@@ -17,6 +17,7 @@ protected:
|
|||||||
std::string inputString; //This is the string that you want to encode or decode
|
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 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
|
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<unsigned int> offset; //This holds the offsets computed from each character in the keyword
|
std::vector<unsigned int> 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 setOffset(); //Uses keyword to calculate the offset for the Caesar cipher for each character
|
||||||
void setInputString(std::string input); //Sets inputString
|
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 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
|
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
|
void reset(); //Makes sure all of the variables are empty
|
||||||
|
static std::string getVersion();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //VIGENERE_HPP
|
#endif //VIGENERE_HPP
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
//Ciphers/SourceFiles/Atbash.cpp
|
//Ciphers/SourceFiles/Atbash.cpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-30-18
|
// Created: 4-30-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the implementation of the Atbash class
|
//This file contains the implementation of the Atbash class
|
||||||
|
|
||||||
|
|
||||||
#include "../Headers/Atbash.hpp"
|
#include "../Headers/Atbash.hpp"
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current library's version number
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const std::string Atbash::version = "1.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new Atbash object
|
* @brief Construct a new Atbash object
|
||||||
*
|
*
|
||||||
@@ -121,3 +128,12 @@ std::string Atbash::decode(std::string input){
|
|||||||
void Atbash::reset(){
|
void Atbash::reset(){
|
||||||
inputString = outputString = "";
|
inputString = outputString = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a string containing the version information
|
||||||
|
*
|
||||||
|
* @return The version information
|
||||||
|
*/
|
||||||
|
std::string Atbash::getVersion(){
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/SourceFiles/Autokey.cpp
|
//Ciphers/SourceFiles/Autokey.cpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 5-3-18
|
// Created: 5-3-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the implementation of the Autokey class
|
//This file contains the implementation of the Autokey class
|
||||||
|
|
||||||
|
|
||||||
@@ -9,6 +9,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current library's version number
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const std::string Vigenere::version = "1.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new Autokey object
|
* @brief Construct a new Autokey object
|
||||||
*
|
*
|
||||||
@@ -137,4 +143,13 @@ std::string Autokey::decode(std::string key, std::string input){
|
|||||||
setInputString(input);
|
setInputString(input);
|
||||||
decodeSet(key, input); //Decoding is a bit different because part of the key is also part of the original message
|
decodeSet(key, input); //Decoding is a bit different because part of the key is also part of the original message
|
||||||
return Autokey::decode();
|
return Autokey::decode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a string containing the version information
|
||||||
|
*
|
||||||
|
* @return The version information
|
||||||
|
*/
|
||||||
|
std::string Autokey::getVersion(){
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/SourceFiles/Caesar.hpp
|
//Ciphers/SourceFiles/Caesar.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-25-18
|
// Created: 4-25-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the implementation of the Caesar class
|
//This file contains the implementation of the Caesar class
|
||||||
//This class implements the Caesar Cipher and is inteded to be turned into a library
|
//This class implements the Caesar Cipher and is inteded to be turned into a library
|
||||||
|
|
||||||
@@ -11,6 +11,12 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current library's version number
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const std::string Caesar::version = "1.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new Caesar:: Caesar object
|
* @brief Construct a new Caesar:: Caesar object
|
||||||
*
|
*
|
||||||
@@ -182,3 +188,12 @@ void Caesar::reset(){
|
|||||||
inputString = outputString = "";
|
inputString = outputString = "";
|
||||||
shift = 0;
|
shift = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a string containing the version information
|
||||||
|
*
|
||||||
|
* @return The version information
|
||||||
|
*/
|
||||||
|
std::string Caesar::getVersion(){
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/SourceFiles/Morse.cpp
|
//Ciphers/SourceFiles/Morse.cpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 5-1-18
|
// Created: 5-1-18
|
||||||
//Modified: 5-1-18
|
//Modified: 5-16-18
|
||||||
//This file contains the implementation of the Morse class
|
//This file contains the implementation of the Morse class
|
||||||
|
|
||||||
|
|
||||||
@@ -10,6 +10,20 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
* @brief Construct a new Morse object
|
||||||
*
|
*
|
||||||
@@ -187,3 +201,12 @@ void Morse::reset(){
|
|||||||
inputString.str("");
|
inputString.str("");
|
||||||
outputString = "";
|
outputString = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a string containing the version information
|
||||||
|
*
|
||||||
|
* @return The version information
|
||||||
|
*/
|
||||||
|
std::string Morse::getVersion(){
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/Headers/Playfair.cpp
|
//Ciphers/Headers/Playfair.cpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-25-18
|
// Created: 4-25-18
|
||||||
//Modified: 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the implementation of the Playfair class
|
//This file contains the implementation of the Playfair class
|
||||||
//It is designed to encrypt and decrypt strings using the Playfair cipher
|
//It is designed to encrypt and decrypt strings using the Playfair cipher
|
||||||
|
|
||||||
@@ -11,6 +11,12 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current library's version number
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const std::string Playfair::version = "1.0";
|
||||||
|
|
||||||
///The letter that needs replaced for the cipher to work
|
///The letter that needs replaced for the cipher to work
|
||||||
char Playfair::REPLACED = 'J';
|
char Playfair::REPLACED = 'J';
|
||||||
///The letter that replaces REPLACED
|
///The letter that replaces REPLACED
|
||||||
@@ -509,3 +515,12 @@ void Playfair::setDoubled(const char doubled){
|
|||||||
DOUBLED = toupper(doubled);
|
DOUBLED = toupper(doubled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a string containing the version information
|
||||||
|
*
|
||||||
|
* @return The version information
|
||||||
|
*/
|
||||||
|
std::string Playfair::getVersion(){
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Ciphers/SourceFiles/Vigenere.cpp
|
//Ciphers/SourceFiles/Vigenere.cpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 4-29-18
|
// Created: 4-29-18
|
||||||
//Modified; 5-5-18
|
//Modified: 5-16-18
|
||||||
//This file contains the implementation of the Vigenere class
|
//This file contains the implementation of the Vigenere class
|
||||||
|
|
||||||
#include "../Headers/Vigenere.hpp"
|
#include "../Headers/Vigenere.hpp"
|
||||||
@@ -10,6 +10,12 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current library's version number
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const std::string Vigenere::version = "1.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new Vigenere object
|
* @brief Construct a new Vigenere object
|
||||||
*
|
*
|
||||||
@@ -212,3 +218,12 @@ void Vigenere::reset(){
|
|||||||
inputString = outputString = keyword = "";
|
inputString = outputString = keyword = "";
|
||||||
offset.clear();
|
offset.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a string containing the version information
|
||||||
|
*
|
||||||
|
* @return The version information
|
||||||
|
*/
|
||||||
|
std::string Vigenere::getVersion(){
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user