Obfuscation: rc.obfuscate=1 hides private details

This commit is contained in:
Paul Beckingham
2015-04-26 10:31:32 -04:00
parent c34b2b8cfb
commit 5d60f426a8
5 changed files with 45 additions and 0 deletions

View File

@@ -624,6 +624,38 @@ int strippedLength (const std::string& input)
return count;
}
////////////////////////////////////////////////////////////////////////////////
const std::string obfuscateText (const std::string& input)
{
std::stringstream output;
std::string::size_type i = 0;
int character;
bool inside = false;
while ((character = utf8_next_char (input, i)))
{
if (inside)
{
output << (char) character;
if (character == 'm')
inside = false;
}
else
{
if (character == 033)
inside = true;
if (inside || character == ' ')
output << (char) character;
else
output << 'x';
}
}
return output.str ();
}
////////////////////////////////////////////////////////////////////////////////
const std::string format (char value)
{