diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2026-10-22 15:05:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-22 15:05:23 -0500 |
| commit | e1d35f666cc35f6ead55d32ea2679df44d04da72 (patch) | |
| tree | dbcb08cbc40cb0f3e630a5c63201876a7a1e467a /Source/Core/Common/Hash.h | |
| parent | 10d958e66bb5d7574166a10f57839a288c5a7c64 (diff) | |
| parent | 7e46e85e8fb3cff68f05bc160c7ac3ed77b1414b (diff) | |
Merge pull request #14913 from jordan-woyak/md5
Common: Introduce MD5Context class and ComputeMD5 function to minimize mbedtls dependence.
Diffstat (limited to 'Source/Core/Common/Hash.h')
| -rw-r--r-- | Source/Core/Common/Hash.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Core/Common/Hash.h b/Source/Core/Common/Hash.h index 6166b74bd9..531dcd94e1 100644 --- a/Source/Core/Common/Hash.h +++ b/Source/Core/Common/Hash.h @@ -4,6 +4,8 @@ #pragma once #include <cstddef> +#include <memory> +#include <span> #include <string_view> #include "Common/CommonTypes.h" @@ -21,4 +23,24 @@ u32 StartCRC32(); u32 UpdateCRC32(u32 crc, const u8* data, size_t len); u32 ComputeCRC32(const u8* data, size_t len); u32 ComputeCRC32(std::string_view data); + +class MD5Context +{ +public: + MD5Context(); + ~MD5Context(); + + void Update(std::span<const u8> data); + + // output should point to 16 bytes. + void Finish(u8* output); + +private: + struct Impl; + std::unique_ptr<Impl> m_impl; +}; + +// output should point to 16 bytes. +void ComputeMD5(std::span<const u8> input, u8* output); + } // namespace Common |
