diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2024-07-05 21:15:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-05 21:15:00 +0200 |
| commit | 6ddfdc14836eaa24e08545486468dfdfd603f37a (patch) | |
| tree | e3164083a91970a53ad521458046c2c9e4b9470c | |
| parent | 2812e6116e6aa6a7bf75d77bd295dfbd692a797c (diff) | |
| parent | 3a63633be3190930d4245d5eac25e54ebb39350e (diff) | |
Merge pull request #12915 from AdmiralCurtiss/sha1-span
Common/Crypto/SHA1: Use span and string_view for Context::Update()
| -rw-r--r-- | Source/Core/Common/Crypto/SHA1.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/Core/Common/Crypto/SHA1.h b/Source/Core/Common/Crypto/SHA1.h index b828c28f15..6fd29172c0 100644 --- a/Source/Core/Common/Crypto/SHA1.h +++ b/Source/Core/Common/Crypto/SHA1.h @@ -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; }; |
