mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Use systematic approach to generate hash
The basic idea is to hash each class member and then mix them with xor operation. However the `seed` must be handled with care, it should only be introduced once when mixing the hashes of each class member, otherwise under some circumstances the `seed` might xor with itself and thus break the intended effect.
This commit is contained in:
parent
1740f968df
commit
5905c085c6
2 changed files with 2 additions and 2 deletions
|
@ -162,5 +162,5 @@ bool BitTorrent::operator==(const TrackerEntry &left, const TrackerEntry &right)
|
|||
|
||||
uint BitTorrent::qHash(const TrackerEntry &key, const uint seed)
|
||||
{
|
||||
return (::qHash(key.url(), seed) ^ key.tier());
|
||||
return (::qHash(key.url(), seed) ^ ::qHash(key.tier()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue