mirror of
https://bitbucket.org/Mattrixwv/cipherstream.git
synced 2025-12-06 18:33:58 -05:00
Fixed bug that would give invalid results with large offset
This commit is contained in:
@@ -78,7 +78,7 @@ std::string Caesar::getOutputString() const{
|
|||||||
* @return The encoded message (outputString)
|
* @return The encoded message (outputString)
|
||||||
*/
|
*/
|
||||||
std::string Caesar::encode(){
|
std::string Caesar::encode(){
|
||||||
char temp; //A temperary holder for the current working character
|
unsigned char temp; //A temperary holder for the current working character
|
||||||
for(unsigned int cnt = 0;cnt < inputString.size();++cnt){
|
for(unsigned int cnt = 0;cnt < inputString.size();++cnt){
|
||||||
temp = inputString.at(cnt);
|
temp = inputString.at(cnt);
|
||||||
//If it is a upper case letter shift it and wrap if necessary
|
//If it is a upper case letter shift it and wrap if necessary
|
||||||
@@ -130,7 +130,7 @@ std::string Caesar::encode(int shiftAmount, std::string input){
|
|||||||
* @return The decoded message (outputString)
|
* @return The decoded message (outputString)
|
||||||
*/
|
*/
|
||||||
std::string Caesar::decode(){
|
std::string Caesar::decode(){
|
||||||
char temp;
|
unsigned char temp;
|
||||||
for(unsigned int cnt = 0;cnt < inputString.size();++cnt){
|
for(unsigned int cnt = 0;cnt < inputString.size();++cnt){
|
||||||
temp = inputString.at(cnt);
|
temp = inputString.at(cnt);
|
||||||
//If it is an upper case letter shift it and wrap if necessary
|
//If it is an upper case letter shift it and wrap if necessary
|
||||||
|
|||||||
Reference in New Issue
Block a user