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#include <tomcrypt.h>
4
6
7using namespace sourcepp;
8
9std::array<std::byte, 16> crypto::computeMD5(std::span<const std::byte> buffer) {
10 if (!LTM_MATH || buffer.empty()) {
11 return {};
12 }
13
14 hash_state md5;
15 md5_init(&md5);
16 md5_process(&md5, reinterpret_cast<const unsigned char*>(buffer.data()), buffer.size());
17
18 std::array<std::byte, 16> final{};
19 md5_done(&md5, reinterpret_cast<unsigned char*>(final.data()));
20 return final;
21}
std::array< std::byte, 16 > computeMD5(std::span< const std::byte > buffer)
Definition MD5.cpp:9
const bool LTM_MATH
Definition Globals.cpp:7