optimized encryption

This commit is contained in:
Arvid Norberg
2008-08-20 23:05:12 +00:00
parent 42b5cad1f8
commit e58485822b
5 changed files with 52 additions and 36 deletions

View File

@@ -58,7 +58,9 @@ namespace libtorrent
// m_dh_secret.
int compute_secret(const char* remote_pubkey);
const char* get_secret() const;
char const* get_secret() const { return m_dh_secret; }
sha1_hash const& get_hash_xor_mask() const { return m_xor_mask; }
private:
int get_local_key_size() const
@@ -71,6 +73,7 @@ namespace libtorrent
char m_dh_local_key[96];
char m_dh_secret[96];
sha1_hash m_xor_mask;
};
class RC4_handler // Non copyable

View File

@@ -132,6 +132,14 @@ namespace libtorrent
void parse_resume_data(std::vector<char>* resume_data);
#ifndef TORRENT_DISABLE_ENCRYPTION
sha1_hash const& obfuscated_hash() const
{ return m_obfuscated_hash; }
#endif
sha1_hash const& info_hash() const
{ return m_torrent_file->info_hash(); }
// starts the announce timer
void start();
@@ -821,6 +829,11 @@ namespace libtorrent
// longer be used and will be reset
boost::scoped_ptr<std::string> m_name;
#ifndef TORRENT_DISABLE_ENCRYPTION
// this is SHA1("req2" + info-hash), used for
// encrypted hand shakes
sha1_hash m_obfuscated_hash;
#endif
session_settings const& m_settings;
storage_constructor_type m_storage_constructor;