Added a simple unit test to ensure E(D(M)) = M

This commit is contained in:
Leonetienne
2022-02-06 17:58:17 +01:00
parent 19f3d61335
commit 4064483cad
7 changed files with 268 additions and 2 deletions

View File

@@ -102,7 +102,12 @@ namespace GhettoCipher
ss << (char)std::bitset<8>(bitstring.substr(i, 8)).to_ulong();
}
return ss.str();
std::string text = ss.str();
// D<>mp excess nullbytes
text.resize(strlen(text.data()));
return text;
}
//! Will convert a flexible data block to a string
@@ -117,7 +122,12 @@ namespace GhettoCipher
ss << (char)std::bitset<8>(bitstring.substr(i, 8)).to_ulong();
}
return ss.str();
std::string text = ss.str();
// D<>mp excess nullbytes
text.resize(strlen(text.data()));
return text;
}
//! Turns a fixed-size data block into a hex-string