Common/Crypto/SHA1: Use span and string_view for Context::Update()

This commit is contained in:
Admiral H. Curtiss 2024-07-04 22:29:24 +02:00
parent 1b1523d6e0
commit 3a63633be3
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB

View File

@ -6,6 +6,7 @@
#include <array>
#include <limits>
#include <memory>
#include <span>
#include <string_view>
#include <type_traits>
#include <vector>
@ -23,7 +24,11 @@ class Context
public:
virtual ~Context() = default;
virtual void Update(const u8* msg, size_t len) = 0;
void Update(const std::vector<u8>& msg) { return Update(msg.data(), msg.size()); }
void Update(std::span<const u8> msg) { return Update(msg.data(), msg.size()); }
void Update(std::string_view msg)
{
return Update(reinterpret_cast<const u8*>(msg.data()), msg.size());
}
virtual Digest Finish() = 0;
virtual bool HwAccelerated() const = 0;
};