stoneharry

Untitled

Jun 16th, 2012
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1.     // Store sessionkey
  2.     m_account->SetSessionKey(m_sessionkey.AsByteArray());
  3.  
  4.     // Hash the session key so that the logon DB can know
  5.     int HASH_CONSTANT = 0x7A0Bh;
  6.  
  7.     const char* temp = m_sessionkey.AsHexStr();
  8.     SHA1_CONTEXT sha_context;
  9.     SHA1_Init(&sha_context);
  10.     SHA1_Update(&sha_context, temp, 40);
  11.     SHA1_Update(&sha_context, &HASH_CONSTANT, 2);
  12.     char keyhash[24];
  13.     SHA1_Final(keyhash, &sha_context);
  14.  
  15.     // Let the DB know
  16.     sLogonSQL->Execute("UPDATE `account_messages` SET `hash` = '%s' WHERE `account` = '%s';", m_sessionkey.AsDecStr(), m_account->UsernamePtr);
  17.  
  18.     // let the client know
  19.     sha.Initialize();
  20.     sha.UpdateBigNumbers(&A, &M, &m_sessionkey, 0);
  21.     sha.Finalize();
  22.  
  23.     SendProofError(0, sha.GetDigest());
  24.     LOG_DEBUG("[AuthLogonProof] Authentication Success.");
Advertisement
Add Comment
Please, Sign In to add comment