#include "../include/odhtdb/DhtKey.hpp" #include "../include/odhtdb/types.hpp" namespace odhtdb { DhtKey::DhtKey(const Hash &key) : infoHash((const u8*)key.getData(), key.getSize()) { firstByteOriginalValue = infoHash[0]; } DhtKey::DhtKey(const InfoHash &_infoHash) : infoHash(_infoHash) { firstByteOriginalValue = infoHash[0]; } InfoHash DhtKey::getNewDataListenerKey() { infoHash[0] = firstByteOriginalValue; return infoHash; } InfoHash DhtKey::getRequestOldDataKey() { infoHash[0] = firstByteOriginalValue + 1; return infoHash; } InfoHash DhtKey::getPingKey() { infoHash[0] = firstByteOriginalValue + 10; return infoHash; } }