4#ifdef MAL_PACKET_WEAVER_HAS_OPENSSL
9namespace mal_packet_weaver::crypto::SHA
18 [[nodiscard]]
inline Hash ComputeHash(
const ByteView data,
const Hash::HashType hash_type)
23 case Hash::HashType::SHA256:
25 result.resize(SHA256_DIGEST_LENGTH);
26 SHA256(data.as<
const unsigned char>(), data.size(), result.as<
unsigned char>());
29 case Hash::HashType::SHA384:
31 result.resize(SHA384_DIGEST_LENGTH);
32 SHA384(data.as<
const unsigned char>(), data.size(), result.as<
unsigned char>());
35 case Hash::HashType::SHA512:
37 result.resize(SHA512_DIGEST_LENGTH);
38 SHA512(data.as<
const unsigned char>(), data.size(), result.as<
unsigned char>());
44 return Hash{ result, hash_type };
Represents a cryptographic hash value along with its type.