KviCryptEngine::EncryptResult KviLamerizerEngine::encrypt(const char * plainText,KviCString &outBuffer) { outBuffer = plainText; unsigned char * aux = (unsigned char *)outBuffer.ptr(); if(m_bLight) { while(*aux) { if(subst_table_light[*aux]) { *aux = subst_table_light[*aux]; } aux++; } } else { while(*aux) { if(subst_table[*aux]) { *aux = subst_table[*aux]; } aux++; } } if(!m_bLight) { outBuffer.replaceAll("F","Ph"); outBuffer.replaceAll("V","\\/"); } return KviCryptEngine::Encoded; }
QTextCodec * KviLocale::codecForName(const char * pcName) { KviCString szTmp = pcName; bool bSendUtf8; int iIdx = szTmp.findFirstIdx('['); if(iIdx != -1) { // Might be a composite codec: either UTF-8 [child codec] or child codec [UTF-8] KviSmartTextCodec * pCodec = g_pSmartCodecDict->find(pcName); if(pCodec) return pCodec; // got cached copy if(kvi_strEqualCIN("UTF-8 [", pcName, 7)) { // Likely a smart codec that sends UTF-8 szTmp.replaceAll("UTF-8 [", ""); szTmp.replaceAll("]", ""); bSendUtf8 = true; } else { // Likely a smart codec that sends child encoding ? szTmp.cutFromFirst(' '); bSendUtf8 = false; } QTextCodec * pChildCodec = QTextCodec::codecForName(szTmp.ptr()); if(pChildCodec) { pCodec = new KviSmartTextCodec(pcName, pChildCodec, bSendUtf8); if(pCodec->ok()) { g_pSmartCodecDict->replace(pcName, pCodec); return pCodec; } delete pCodec; } else { // The name of the child codec was invalid: can't create such a smart codec. // We probably screwed up the guess above related to the [ char. // This code path is also triggered by the yircfuzzer by specifying completely invalid codec names. } } return QTextCodec::codecForName(pcName); }