Closed ghost closed 7 years ago
Is there any reason for not setting up the crc correctly and using a string instead? I quess that since this lookup happens quite often, the uint comparison would be much faster, would it not?
As can be observed in the old code, there was an error that caused the CRC to always be set to 512
. This was merely an intermediate value that was 'forgotten' to be fixed. Initially, I wanted to use CRC32 indeed, but in the end I abandoned this idea to not need to include any more third-party libraries. Then, I investigated the use of OpenSSL/MD5. The only motivation for using a hashing mechanism is to ensure that, regardless of the length of the input value (e.g., IPv4 or IPv6 addresses), the length of the output value can be guaranteed. Since C++ provides std::string
, this solution will do without relying on external libraries -- albeit not as fast as using uint
comparison.
In any case, what do you propose? We may take this strategy:
OK, let us go with the proposed strategy.
In addition, this pull request features a fix for two invalid debug log messages.