#ifndef MURMUR_HASH_3_HPP_
#define MURMUR_HASH_3_HPP_

#include <cstddef>
#include <cstdint>

class MurmurHash3 final
{
private:
    static constexpr uint32_t c1 = 0xcc9e2d51;
    static constexpr uint32_t c2 = 0x1b873593;
    static constexpr int r1 = 15;
    static constexpr int r2 = 13;
    static constexpr uint32_t m = 5;
    static constexpr uint32_t n = 0xe6546b64;

    uint32_t hash = 0x12345678;
    uint32_t length = 0;

    uint32_t mixConstants(uint32_t k) const;
    void processTail(const uint8_t *tail, size_t remaining);
    uint32_t finalizeMix(uint32_t h) const;

public:
    void feed(const char *data, size_t len);
    uint32_t digest() const;
};

#endif