kdecore: remove now unused KStringHandler::obscure() function

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-16 19:30:36 +03:00
parent 9c6ba7e9e2
commit ecd0102876
4 changed files with 0 additions and 40 deletions

View file

@ -141,16 +141,6 @@ void KStringHandlerTest::naturalCompare()
QCOMPARE(KStringHandler::naturalCompare("abc.jpg", "abc_a.jpg", Qt::CaseInsensitive), -1);
}
void KStringHandlerTest::obscure()
{
// See bug 167900, obscure() produced chars that could not properly be converted to and from
// UTF8. The result was that storing passwords with '!' in them did not work.
QString test = "!TEST!";
QString obscured = KStringHandler::obscure( test );
QByteArray obscuredBytes = obscured.toUtf8();
QCOMPARE( KStringHandler::obscure( QString::fromUtf8( obscuredBytes ) ), test );
}
void KStringHandlerTest::preProcessWrap_data()
{
const QChar zwsp(0x200b);

View file

@ -12,7 +12,6 @@ private Q_SLOTS:
void tagURLs();
void perlSplit();
void naturalCompare();
void obscure();
void preProcessWrap_data();
void preProcessWrap();

View file

@ -185,20 +185,6 @@ QString KStringHandler::tagUrls( const QString& text )
return richText;
}
QString KStringHandler::obscure( const QString &str )
{
QString result;
const QChar *unicode = str.unicode();
for ( int i = 0; i < str.length(); ++i )
// yes, no typo. can't encode ' ' or '!' because
// they're the unicode BOM. stupid scrambling. stupid.
result += ( unicode[ i ].unicode() <= 0x21 ) ? unicode[ i ] :
QChar( 0x1001F - unicode[ i ].unicode() );
return result;
}
bool KStringHandler::isUtf8( const char *buf )
{
int i, n;

View file

@ -165,21 +165,6 @@ namespace KStringHandler
*/
KDECORE_EXPORT QString tagUrls( const QString& text );
/**
Obscure string by using a simple symmetric encryption. Applying the
function to a string obscured by this function will result in the original
string.
The function can be used to obscure passwords stored to configuration
files. Note that this won't give you any more security than preventing
that the password is directly copied and pasted.
@param str string to be obscured
@return obscured string
*/
KDECORE_EXPORT QString obscure( const QString &str );
/**
Guess whether a string is UTF8 encoded.