OXY API 1.0
OXY API Library Documentation
Loading...
Searching...
No Matches
oxy::hash_fn Struct Reference

Functor to compute SHA-1 hashes for various input types. More...

#include <hash.hpp>

Public Member Functions

auto operator() (std::ifstream &in) const -> hash_t
 Specialization for std::ifstream input type.
template<>
auto operator() (std::istringstream const &in) const -> hash_t
 Specialization for std::istringstream input type.
auto operator() (std::wifstream &in) const -> hash_t
 Specialization for std::wifstream input type.
template<>
auto operator() (std::wistringstream const &in) const -> hash_t
 Specialization for std::wistringstream input type.
template<typename T>
auto operator() (T const &in) const -> hash_t

Detailed Description

Functor to compute SHA-1 hashes for various input types.

This functor provides an operator() that takes different types of input (e.g., strings, streams) and returns the corresponding SHA-1 hash as a string. It is designed to be used in a constexpr context for compile-time evaluation of hashing operations.

Member Function Documentation

◆ operator()() [1/5]

auto oxy::hash_fn::operator() ( std::ifstream & in) const -> hash_t
inline

Specialization for std::ifstream input type.

Parameters
in- The input std::ifstream to be hashed.
Returns
The SHA-1 hash of the input data as a string.

References operator()().

◆ operator()() [2/5]

template<>
auto oxy::hash_fn::operator() ( std::istringstream const & in) const -> hash_t
inline

Specialization for std::istringstream input type.

Parameters
in- The input std::istringstream to be hashed.
Returns
The SHA-1 hash of the input data as a string.

References operator()().

◆ operator()() [3/5]

auto oxy::hash_fn::operator() ( std::wifstream & in) const -> hash_t
inline

Specialization for std::wifstream input type.

Parameters
in- The input std::wifstream to be hashed.
Returns
The SHA-1 hash of the input data as a string.

References operator()().

◆ operator()() [4/5]

template<>
auto oxy::hash_fn::operator() ( std::wistringstream const & in) const -> hash_t
inline

Specialization for std::wistringstream input type.

Parameters
in- The input std::wistringstream to be hashed.
Returns
The SHA-1 hash of the input data as a string.

References operator()().

◆ operator()() [5/5]

template<typename T>
auto oxy::hash_fn::operator() ( T const & in) const -> hash_t
inline
Parameters
in- The input data to be hashed (can be a string, stream, etc.).
Returns
The SHA-1 hash of the input data as a string.

References oxy::hash, and oxy::to_string().

Referenced by operator()(), operator()(), operator()(), and operator()().