// Generated by Lisette bindgen
// Source: hash/maphash (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

import "go:hash"

/// Bytes returns the hash of b with the given seed.
/// 
/// Bytes is equivalent to, but more convenient and efficient than:
/// 
/// 	var h Hash
/// 	h.SetSeed(seed)
/// 	h.Write(b)
/// 	return h.Sum64()
pub fn Bytes(seed: Seed, b: Slice<byte>) -> uint64

/// Comparable returns the hash of comparable value v with the given seed
/// such that Comparable(s, v1) == Comparable(s, v2) if v1 == v2.
/// If v != v, then the resulting hash is randomly distributed.
pub fn Comparable<T: Comparable>(seed: Seed, v: T) -> uint64

/// MakeSeed returns a new random seed.
pub fn MakeSeed() -> Seed

/// String returns the hash of s with the given seed.
/// 
/// String is equivalent to, but more convenient and efficient than:
/// 
/// 	var h Hash
/// 	h.SetSeed(seed)
/// 	h.WriteString(s)
/// 	return h.Sum64()
pub fn String(seed: Seed, s: string) -> uint64

/// WriteComparable adds x to the data hashed by h.
pub fn WriteComparable<T: Comparable>(h: Ref<Hash>, x: T)

/// A Hash computes a seeded hash of a byte sequence.
/// 
/// The zero Hash is a valid Hash ready to use.
/// A zero Hash chooses a random seed for itself during
/// the first call to a Reset, Write, Seed, Clone, or Sum64 method.
/// For control over the seed, use SetSeed.
/// 
/// The computed hash values depend only on the initial seed and
/// the sequence of bytes provided to the Hash object, not on the way
/// in which the bytes are provided. For example, the three sequences
/// 
/// 	h.Write([]byte{'f','o','o'})
/// 	h.WriteByte('f'); h.WriteByte('o'); h.WriteByte('o')
/// 	h.WriteString("foo")
/// 
/// all have the same effect.
/// 
/// Hashes are intended to be collision-resistant, even for situations
/// where an adversary controls the byte sequences being hashed.
/// 
/// A Hash is not safe for concurrent use by multiple goroutines, but a Seed is.
/// If multiple goroutines must compute the same seeded hash,
/// each can declare its own Hash and call SetSeed with a common Seed.
pub type Hash

/// A Seed is a random value that selects the specific hash function
/// computed by a [Hash]. If two Hashes use the same Seeds, they
/// will compute the same hash values for any given input.
/// If two Hashes use different Seeds, they are very likely to compute
/// distinct hash values for any given input.
/// 
/// A Seed must be initialized by calling [MakeSeed].
/// The zero seed is uninitialized and not valid for use with [Hash]'s SetSeed method.
/// 
/// Each Seed value is local to a single process and cannot be serialized
/// or otherwise recreated in a different process.
pub type Seed

impl Hash {
  /// BlockSize returns h's block size.
  fn BlockSize(self: Ref<Hash>) -> int

  /// Clone implements [hash.Cloner].
  fn Clone(self: Ref<Hash>) -> Result<hash.Cloner, error>

  /// Reset discards all bytes added to h.
  /// (The seed remains the same.)
  fn Reset(self: Ref<Hash>)

  /// Seed returns h's seed value.
  fn Seed(self: Ref<Hash>) -> Seed

  /// SetSeed sets h to use seed, which must have been returned by [MakeSeed]
  /// or by another [Hash.Seed] method.
  /// Two [Hash] objects with the same seed behave identically.
  /// Two [Hash] objects with different seeds will very likely behave differently.
  /// Any bytes added to h before this call will be discarded.
  fn SetSeed(self: Ref<Hash>, seed: Seed)

  /// Size returns h's hash value size, 8 bytes.
  fn Size(self: Ref<Hash>) -> int

  /// Sum appends the hash's current 64-bit value to b.
  /// It exists for implementing [hash.Hash].
  /// For direct calls, it is more efficient to use [Hash.Sum64].
  fn Sum(self: Ref<Hash>, mut b: Slice<byte>) -> Slice<byte>

  /// Sum64 returns h's current 64-bit value, which depends on
  /// h's seed and the sequence of bytes added to h since the
  /// last call to [Hash.Reset] or [Hash.SetSeed].
  /// 
  /// All bits of the Sum64 result are close to uniformly and
  /// independently distributed, so it can be safely reduced
  /// by using bit masking, shifting, or modular arithmetic.
  fn Sum64(self: Ref<Hash>) -> uint64

  /// Write adds b to the sequence of bytes hashed by h.
  /// It always writes all of b and never fails; the count and error result are for implementing [io.Writer].
  fn Write(self: Ref<Hash>, b: Slice<byte>) -> Partial<int, error>

  /// WriteByte adds b to the sequence of bytes hashed by h.
  /// It never fails; the error result is for implementing [io.ByteWriter].
  fn WriteByte(self: Ref<Hash>, b: byte) -> Result<(), error>

  /// WriteString adds the bytes of s to the sequence of bytes hashed by h.
  /// It always writes all of s and never fails; the count and error result are for implementing [io.StringWriter].
  fn WriteString(self: Ref<Hash>, s: string) -> Partial<int, error>
}
