21#ifndef XRDCLHTTPCHECKSUM_HH_
22#define XRDCLHTTPCHECKSUM_HH_
77 if (str ==
"crc32c") {
79 }
else if (str ==
"md5") {
81 }
else if (str ==
"sha1") {
83 }
else if (str ==
"sha256") {
93 std::array<unsigned char, g_max_checksum_length>
value;
119 const std::array<unsigned char, g_max_checksum_length> &
Get(
ChecksumType ctype)
const {
122 return checksums[
static_cast<size_t>(ctype)].value;
128 bool Set(
ChecksumType ctype,
const std::array<unsigned char, g_max_checksum_length> &value) {
130 checksums[
static_cast<size_t>(ctype)] =
ChecksumEntry{ctype, value};
137 std::tuple<ChecksumType, std::array<unsigned char, g_max_checksum_length>,
bool>
GetFirst()
const {
140 return std::make_tuple(
static_cast<ChecksumType>(idx), checksums[idx].value,
true);
143 return std::make_tuple(
ChecksumType::kUnknown, std::array<unsigned char, g_max_checksum_length>(),
false);
const std::array< unsigned char, g_max_checksum_length > & Get(ChecksumType ctype) const
bool IsSet(ChecksumType ctype) const
bool Set(ChecksumType ctype, const std::array< unsigned char, g_max_checksum_length > &value)
std::tuple< ChecksumType, std::array< unsigned char, g_max_checksum_length >, bool > GetFirst() const
size_t GetChecksumLength(ChecksumType ctype)
constexpr size_t g_max_checksum_length
ChecksumType GetTypeFromString(const std::string &str)
std::array< unsigned char, g_max_checksum_length > value
const std::string GetTypeString(ChecksumType ctype)