diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2024-05-14 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2024-05-15 23:55:04 +0500 |
commit | fc662341e6f85da78ada0e443f6116b978f79f22 (patch) | |
tree | 1be1cc402a7a9cbc18d4eeea6b141354c2d559e3 /C/Xxh64.h | |
parent | 5b39dc76f1bc82f941d5c800ab9f34407a06b53a (diff) | |
download | 7zip-24.05.tar.gz 7zip-24.05.tar.bz2 7zip-24.05.zip |
24.0524.05
Diffstat (limited to 'C/Xxh64.h')
-rw-r--r-- | C/Xxh64.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/C/Xxh64.h b/C/Xxh64.h new file mode 100644 index 0000000..efef65e --- /dev/null +++ b/C/Xxh64.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* Xxh64.h -- XXH64 hash calculation interfaces | ||
2 | 2023-08-18 : Igor Pavlov : Public domain */ | ||
3 | |||
4 | #ifndef ZIP7_INC_XXH64_H | ||
5 | #define ZIP7_INC_XXH64_H | ||
6 | |||
7 | #include "7zTypes.h" | ||
8 | |||
9 | EXTERN_C_BEGIN | ||
10 | |||
11 | #define Z7_XXH64_BLOCK_SIZE (4 * 8) | ||
12 | |||
13 | typedef struct | ||
14 | { | ||
15 | UInt64 v[4]; | ||
16 | } CXxh64State; | ||
17 | |||
18 | void Xxh64State_Init(CXxh64State *p); | ||
19 | |||
20 | // end != data && end == data + Z7_XXH64_BLOCK_SIZE * numBlocks | ||
21 | void Z7_FASTCALL Xxh64State_UpdateBlocks(CXxh64State *p, const void *data, const void *end); | ||
22 | |||
23 | /* | ||
24 | Xxh64State_Digest(): | ||
25 | data: | ||
26 | the function processes only | ||
27 | (totalCount & (Z7_XXH64_BLOCK_SIZE - 1)) bytes in (data): (smaller than 32 bytes). | ||
28 | totalCount: total size of hashed stream: | ||
29 | it includes total size of data processed by previous Xxh64State_UpdateBlocks() calls, | ||
30 | and it also includes current processed size in (data). | ||
31 | */ | ||
32 | UInt64 Xxh64State_Digest(const CXxh64State *p, const void *data, UInt64 totalCount); | ||
33 | |||
34 | |||
35 | typedef struct | ||
36 | { | ||
37 | CXxh64State state; | ||
38 | UInt64 count; | ||
39 | UInt64 buf64[4]; | ||
40 | } CXxh64; | ||
41 | |||
42 | void Xxh64_Init(CXxh64 *p); | ||
43 | void Xxh64_Update(CXxh64 *p, const void *data, size_t size); | ||
44 | |||
45 | #define Xxh64_Digest(p) \ | ||
46 | Xxh64State_Digest(&(p)->state, (p)->buf64, (p)->count) | ||
47 | |||
48 | EXTERN_C_END | ||
49 | |||
50 | #endif | ||