SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
MD5.cpp
Go to the documentation of this file.
2
3#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
4#include <cryptopp/md5.h>
5
6using namespace sourcepp;
7
8std::array<std::byte, 16> crypto::computeMD5(std::span<const std::byte> buffer) {
9 // Make sure this is right
10 static_assert(CryptoPP::Weak::MD5::DIGESTSIZE == sizeof(std::array<std::byte, 16>));
11
12 CryptoPP::Weak::MD5 md5;
13 md5.Update(reinterpret_cast<const CryptoPP::byte*>(buffer.data()), buffer.size());
14
15 std::array<std::byte, 16> final{};
16 md5.Final(reinterpret_cast<CryptoPP::byte*>(final.data()));
17 return final;
18}
std::array< std::byte, 16 > computeMD5(std::span< const std::byte > buffer)
Definition: MD5.cpp:8
Definition: LZMA.h:11