Ja - das mit dem *.toUtf8() ist mir Zwischenzeitlich auch aufgefallen.
Das eigentliche Problem war meine Größenangabe.
Was mich zusätzlich Irritiert hat war die Darstellung beim Debuggen 
Hier die entgültige Lösung - Der Code wird benötigt um sich bei AVM DSL Modems ab Firmware-Version xx.04.74 an zumelden.
PHP-Code:
const QByteArray PasswordDialog::createMd5Hash ()
{
QByteArray realm;
realm.append ( challenge.toUtf8() );
realm.append ( '-' );
realm.append ( textValue().toUtf8() );
size_t invalid = -1;
iconv_t cd = iconv_open ( "UTF-16LE", "UTF-8" );
char* inbuf = realm.data();
size_t inbytesleft = ( strlen ( inbuf ) * sizeof ( char ) );
size_t outbytesleft = ( inbytesleft * 2 );
QByteArray utf16str ( outbytesleft, Qt::Uninitialized );
char *outbuf = utf16str.data();
do
{
if ( iconv ( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft ) == invalid )
{
qWarning ( "converting characters failed" );
iconv_close ( cd );
delete[] outbuf;
break;
}
}
while ( inbytesleft != 0 );
utf16str.resize ( utf16str.size() - outbytesleft );
iconv_close ( cd );
// qDebug() << QTextCodec::codecForMib ( 1015 )->toUnicode ( utf16str.constData(), utf16str.size() );
QCryptographicHash qcrHash ( QCryptographicHash::Md5 );
qcrHash.addData ( utf16str.constData(), utf16str.size() );
return qcrHash.result().toHex();
}
Lesezeichen