Skip to content

File keccakhash.h

File List > code_source > templat > include > TempLat > util > hash > keccakhash.h

Go to the documentation of this file

#ifndef TEMPLAT_UTIL_HASH_KECCAKHASH_H
#define TEMPLAT_UTIL_HASH_KECCAKHASH_H

/* This file is part of TempLat, available at https://cosmolattice.github.io/templat .
   Copyright 2021-2026 The TempLat authors, see AUTHORS.md.
   Released under the MIT license, see LICENSE.md. */

// File info: Main contributor(s): Wessel Valkenburg, Year: 2019
/* \file This file uses libkeccak.h, the stand-alone implementation
 * of the keccak hash algorithm. The reason to use this rather than
 * std::hash, is that std::hash is explicitly not guaranteed to be stable
 * across implementations (compilers, platforms, ...).
 * We insist on having something stable across platforms,
 * such that your hashes which you may use for random seeds
 * are the same, such that the physics you simulate is identical
 * across platforms. */

#include "TempLat/util/hash/keccakhashbareclass.h"

namespace TempLat
{

  class KeccakHash
  {
  public:
    // Put public methods here. These should change very little over time.

    using ResultType = KeccakHashBareClass;

    template <typename T> static ResultType compute(const T &input)
    {
      ResultType result;
      result.compute(input);
      return result;
    }

  private:
    /* Put all member variables and private methods here. These may change arbitrarily. */
    KeccakHash() = default;
  };
} // namespace TempLat

#endif