I have been trying to find a replacement string function that would allow me to use std::string like behaviour in C#. I just need it for some code I ported across from C++ to C# that had std::strings in them. I've read about converting the strings to byte array and then working it out from there although I am unable to do so. Any possible suggestion of doing this with an example code? Please note the below code was written in C++ using std::strings instead of C# Unicode string.
C++ Code
std::string DeMangleCode(const std::string& argMangledCode) const
{
std::string unencrypted;
for (uint32_t temp = 0; temp < argMangledCode.size(); temp++)
{
unencrypted += argMangledCode[temp] ^ (434 + temp) % 255;
}
return unencrypted;
}
Mangled Input: ‚‡…ƒ
Output: 1305