formatting fixes for pe_crypto.cpp

This commit is contained in:
Arvid Norberg 2008-12-27 16:44:20 +00:00
parent b81ae19e86
commit 4ccf2af653
1 changed files with 8 additions and 9 deletions

View File

@ -81,13 +81,12 @@ namespace libtorrent
public: public:
// Input longkeys must be 20 bytes // Input longkeys must be 20 bytes
RC4_handler(const sha1_hash& rc4_local_longkey, RC4_handler(const sha1_hash& rc4_local_longkey,
const sha1_hash& rc4_remote_longkey) const sha1_hash& rc4_remote_longkey)
{ {
RC4_set_key(&m_local_key, 20, RC4_set_key(&m_local_key, 20,
reinterpret_cast<unsigned char const*>(rc4_local_longkey.begin())); reinterpret_cast<unsigned char const*>(rc4_local_longkey.begin()));
RC4_set_key(&m_remote_key, 20, RC4_set_key(&m_remote_key, 20,
reinterpret_cast<unsigned char const*>(rc4_remote_longkey.begin())); reinterpret_cast<unsigned char const*>(rc4_remote_longkey.begin()));
// Discard first 1024 bytes // Discard first 1024 bytes
char buf[1024]; char buf[1024];
@ -102,8 +101,8 @@ namespace libtorrent
TORRENT_ASSERT(len >= 0); TORRENT_ASSERT(len >= 0);
TORRENT_ASSERT(pos); TORRENT_ASSERT(pos);
RC4 (&m_local_key, len, reinterpret_cast<unsigned char const*>(pos), RC4(&m_local_key, len, reinterpret_cast<unsigned char const*>(pos),
reinterpret_cast<unsigned char*>(pos)); reinterpret_cast<unsigned char*>(pos));
} }
void decrypt(char* pos, int len) void decrypt(char* pos, int len)
@ -111,15 +110,15 @@ namespace libtorrent
TORRENT_ASSERT(len >= 0); TORRENT_ASSERT(len >= 0);
TORRENT_ASSERT(pos); TORRENT_ASSERT(pos);
RC4 (&m_remote_key, len, reinterpret_cast<unsigned char const*>(pos), RC4(&m_remote_key, len, reinterpret_cast<unsigned char const*>(pos),
reinterpret_cast<unsigned char*>(pos)); reinterpret_cast<unsigned char*>(pos));
} }
private: private:
RC4_KEY m_local_key; // Key to encrypt outgoing data RC4_KEY m_local_key; // Key to encrypt outgoing data
RC4_KEY m_remote_key; // Key to decrypt incoming data RC4_KEY m_remote_key; // Key to decrypt incoming data
}; };
} // namespace libtorrent } // namespace libtorrent
#endif // TORRENT_PE_CRYPTO_HPP_INCLUDED #endif // TORRENT_PE_CRYPTO_HPP_INCLUDED