aboutsummaryrefslogtreecommitdiff
path: root/C/Xxh64.h
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2024-05-14 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2024-05-15 23:55:04 +0500
commitfc662341e6f85da78ada0e443f6116b978f79f22 (patch)
tree1be1cc402a7a9cbc18d4eeea6b141354c2d559e3 /C/Xxh64.h
parent5b39dc76f1bc82f941d5c800ab9f34407a06b53a (diff)
download7zip-fc662341e6f85da78ada0e443f6116b978f79f22.tar.gz
7zip-fc662341e6f85da78ada0e443f6116b978f79f22.tar.bz2
7zip-fc662341e6f85da78ada0e443f6116b978f79f22.zip
24.0524.05
Diffstat (limited to 'C/Xxh64.h')
-rw-r--r--C/Xxh64.h50
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
22023-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
9EXTERN_C_BEGIN
10
11#define Z7_XXH64_BLOCK_SIZE (4 * 8)
12
13typedef struct
14{
15 UInt64 v[4];
16} CXxh64State;
17
18void Xxh64State_Init(CXxh64State *p);
19
20// end != data && end == data + Z7_XXH64_BLOCK_SIZE * numBlocks
21void Z7_FASTCALL Xxh64State_UpdateBlocks(CXxh64State *p, const void *data, const void *end);
22
23/*
24Xxh64State_Digest():
25data:
26 the function processes only
27 (totalCount & (Z7_XXH64_BLOCK_SIZE - 1)) bytes in (data): (smaller than 32 bytes).
28totalCount: 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*/
32UInt64 Xxh64State_Digest(const CXxh64State *p, const void *data, UInt64 totalCount);
33
34
35typedef struct
36{
37 CXxh64State state;
38 UInt64 count;
39 UInt64 buf64[4];
40} CXxh64;
41
42void Xxh64_Init(CXxh64 *p);
43void 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
48EXTERN_C_END
49
50#endif