Merge pull request #12915 from AdmiralCurtiss/sha1-span
Common/Crypto/SHA1: Use span and string_view for Context::Update()
This commit is contained in:
commit
6ddfdc1483
|
@ -6,6 +6,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <span>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -23,7 +24,11 @@ class Context
|
||||||
public:
|
public:
|
||||||
virtual ~Context() = default;
|
virtual ~Context() = default;
|
||||||
virtual void Update(const u8* msg, size_t len) = 0;
|
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 Digest Finish() = 0;
|
||||||
virtual bool HwAccelerated() const = 0;
|
virtual bool HwAccelerated() const = 0;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue