SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
Adler32.cpp
Go to the documentation of this file.
1
#include <
sourcepp/crypto/Adler32.h
>
2
3
#include <BufferStream.h>
4
#include <tomcrypt.h>
5
6
#include <
sourcepp/crypto/Globals.h
>
7
8
using namespace
sourcepp
;
9
10
uint32_t
crypto::computeAdler32
(std::span<const std::byte> buffer) {
11
if
(!
LTM_MATH
|| buffer.empty()) {
12
return
0;
13
}
14
15
adler32_state adler32{};
16
// do NOT call init! must start zeroed, init changes this (necessary for GCF)
17
adler32_update(&adler32,
reinterpret_cast<
const
unsigned
char
*
>
(buffer.data()), buffer.size());
18
19
uint32_t
final
;
20
adler32_finish(&adler32, &
final
,
sizeof
(
final
));
21
BufferStream::swap_endian(&
final
);
22
return
final
;
23
}
Adler32.h
Globals.h
sourcepp::crypto::LTM_MATH
const bool LTM_MATH
Definition
Globals.cpp:7
sourcepp::crypto::computeAdler32
uint32_t computeAdler32(std::span< const std::byte > buffer)
Definition
Adler32.cpp:10
sourcepp
Definition
LZMA.h:11
src
sourcepp
crypto
Adler32.cpp
Generated on
for SourcePP by
1.16.1