uint32_t Hash64WithSeedLow(const char* s, size_t len, uint64_t seed) {
  return static_cast<uint32_t>(Hash64WithSeed(s, len, seed));
}

uint32_t Hash64WithSeedHigh(const char* s, size_t len, uint64_t seed) {
  return static_cast<uint32_t>(Hash64WithSeed(s, len, seed) >> 32);
}

// Hash the concatenation of the given string with itself.
uint64_t Hash64WithSeedD(const char* s, size_t len, uint64_t seed) {
  char buf[8000];
  char* ss = len*2 > sizeof(buf) ? (char*)malloc(len*2) : buf;
  memcpy(ss, s, len);
  memcpy(ss + len, s, len);
  uint64_t h = Hash64WithSeed(ss, len*2, seed);
  if (ss != buf) free(ss);
  return h;
}

// Hash the concatenation of the given string with itself.
uint32_t Hash64WithSeedDLow(const char* s, size_t len, uint64_t seed) {
  return static_cast<uint32_t>(Hash64WithSeedD(s, len, seed));
}

// Hash the concatenation of the given string with itself.
uint32_t Hash64WithSeedDHigh(const char* s, size_t len, uint64_t seed) {
  return static_cast<uint32_t>(Hash64WithSeedD(s, len, seed) >> 32);
}

// Hash the concatenation of the given string with 3 copies of itself.
uint64_t Hash64WithSeedQ(const char* s, size_t len, uint64_t seed) {
  char buf[8000];
  char* ss = len*4 > sizeof(buf) ? (char*)malloc(len*4) : buf;
  memcpy(ss, s, len);
  memcpy(ss + len, s, len);
  memcpy(ss + len*2, ss, len*2);
  uint64_t h = Hash64WithSeed(ss, len*4, seed);
  if (ss != buf) free(ss);
  return h;
}

// Hash the concatenation of the given string with 3 copies of itself.
uint32_t Hash64WithSeedQLow(const char* s, size_t len, uint64_t seed) {
  return static_cast<uint32_t>(Hash64WithSeedQ(s, len, seed));
}

// Hash the concatenation of the given string with 3 copies of itself.
uint32_t Hash64WithSeedQHigh(const char* s, size_t len, uint64_t seed) {
  return static_cast<uint32_t>(Hash64WithSeedQ(s, len, seed) >> 32);
}
