SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
SHA1.cpp
Go to the documentation of this file.
1
#include <
sourcepp/crypto/SHA1.h
>
2
3
#include <tomcrypt.h>
4
5
#include <
sourcepp/crypto/Globals.h
>
6
7
using namespace
sourcepp
;
8
9
std::array<std::byte, 20>
crypto::computeSHA1
(std::span<const std::byte> buffer) {
10
if
(!
LTM_MATH
|| buffer.empty()) {
11
return
{};
12
}
13
14
hash_state sha1;
15
sha1_init(&sha1);
16
sha1_process(&sha1,
reinterpret_cast<
const
unsigned
char
*
>
(buffer.data()), buffer.size());
17
18
std::array<std::byte, 20>
final
{};
19
sha1_done(&sha1,
reinterpret_cast<
unsigned
char
*
>
(
final
.data()));
20
return
final
;
21
}
Globals.h
SHA1.h
sourcepp::crypto::computeSHA1
std::array< std::byte, 20 > computeSHA1(std::span< const std::byte > buffer)
Definition
SHA1.cpp:9
sourcepp::crypto::LTM_MATH
const bool LTM_MATH
Definition
Globals.cpp:7
sourcepp
Definition
LZMA.h:11
src
sourcepp
crypto
SHA1.cpp
Generated on
for SourcePP by
1.16.1