예제 #1
0
void KUserFiles::createPassword( KU::KUser *user, const QString &password )
{
  if ( caps & Cap_Shadow ) {
    user->setSPwd( encryptPass( password, mCfg->md5shadow() ) );
    user->setPwd( QString::fromLatin1("x") );
  } else
    user->setPwd( encryptPass( password, false ) );
}
예제 #2
0
NString makePacket(std::string username, std::string password)
{
    MD5 md5;

    if (!md5IsSet)
    {
        md5_nostaleX = md5.digestFile((nostalePath + "\\NostaleX.dat").c_str());
        md5_nostale = md5.digestFile((nostalePath + "\\Nostale.dat").c_str());
        md5IsSet = true;
    }

    std::string md5_hash = md5_nostaleX + md5_nostale + username;

    NString packet("NoS0575 ");
    //packet.reserve(8 + username.length() + 1 + password.length() * 4 + 4 + 9 + 1 + 13 + 32 + 1); // Pre-allocate size
    packet << (uint32_t)(seedRandom(0x989680) + 0x86111);
    packet << ' ' << username << ' ' << encryptPass(password);
    packet << ' ' << fmt::pad(fmt::hexu(seedRandom(0x989680)), 8, '0');
    packet << (uint8_t)0x0B << "0.9.3.3055 0 " << md5.digestString(md5_hash) << (uint8_t)0x0A;

    return packet;
}