murmur3.h 749 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <array>
  3. #include <cstddef>
  4. #include <span>
  5. namespace sunrise::middleware::crypto::murmur3 {
  6. /** The 128-bit variant produces 16 bytes. */
  7. inline constexpr std::size_t kDigestSize = 16;
  8. /** One finished digest. */
  9. using Digest = std::array<std::byte, kDigestSize>;
  10. /**
  11. * Hashes two buffers as one message with the 64-bit 128-wide variant, seed zero.
  12. * Two buffers, not one: callers hash a fixed block followed by a body.
  13. * @param first Leading bytes.
  14. * @param second Trailing bytes, possibly empty.
  15. * @param output Receives the digest.
  16. */
  17. void hash(std::span<const std::byte> first,
  18. std::span<const std::byte> second,
  19. Digest& output) noexcept;
  20. } // namespace sunrise::middleware::crypto::murmur3