- std::string SegmentCloak(const std::string& item, char id)
- {
- std::string input;
- input.reserve(key.length() + 3 + item.length());
- input.append(1, id);
- input.append(key);
- input.append(1, 0); // null does not terminate a C++ string
- input.append(item);
-
- HashRequest hash(this, HashProvider, input);
- std::string rv = hash.binresult.substr(0,6);
- for(int i=0; i < 6; i++)
- {
- // this discards 3 bits per byte. We have an
- // overabundance of bits in the hash output, doesn't
- // matter which ones we are discarding.
- rv[i] = base32[rv[i] & 0x1F];
- }
- return rv;
- }
-
- void CloakExistingUsers()
- {
- std::string* cloak;
- for (std::vector<LocalUser*>::iterator u = ServerInstance->Users->local_users.begin(); u != ServerInstance->Users->local_users.end(); u++)
- {
- cloak = cu.ext.get(*u);
- if (!cloak)
- {
- OnUserConnect(*u);
- }
- }
- }
-