#include <climits>
#include "aggressive_nsec.hh"
+#include "base64.hh"
#include "cachecleaner.hh"
#include "recursor_cache.hh"
#include "logger.hh"
const auto minLength = std::min(one.length(), two.length());
for (size_t i = 0; i < minLength; i++) {
- const auto byte1 = one.at(i);
- const auto byte2 = two.at(i);
+ const uint8_t byte1 = one.at(i);
+ const uint8_t byte2 = two.at(i);
// shortcut
if (byte1 == byte2) {
length += CHAR_BIT;
- if (length > bound) {
- return true;
- }
continue;
}
+ if (byte1 > byte2) { // order is reversed, implies large number of hashes covered
+ return false;
+ }
+ if (length > bound) {
+ return true;
+ }
// bytes differ, let's look at the bits
for (ssize_t j = CHAR_BIT - 1; j >= 0; j--) {
const auto bit1 = byte1 & (1 << j);
{"8ujhshp2lhmnpoo9qde4blg4gq3hgl99", "8ujhshp2lhmnpoo9qde4blg4gq3hgl99", 0, false},
{"8ujhshp2lhmnpoo9qde4blg4gq3hgl99", "8ujhshp2lhmnpoo9qde4blg4gq3hgl99", 1, false},
{"8ujhshp2lhmnpoo9qde4blg4gq3hgl99", "8ujhshp2lhmnpoo9qde4blg4gq3hgl99", 157, false},
+ {"e731tdlrdip60smlihgnprqdspq0idlp", "e731tcnkl5al8t4r64b292blt4c37j3h", 1, false}, // note order: 1st > 2nd
};
for (const auto& [owner, next, boundary, result] : table) {