diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /C/Blake2.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.tar.gz 7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.tar.bz2 7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.zip |
'21.07'21.07
Diffstat (limited to 'C/Blake2.h')
-rw-r--r-- | C/Blake2.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/C/Blake2.h b/C/Blake2.h new file mode 100644 index 0000000..14f3cb6 --- /dev/null +++ b/C/Blake2.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* Blake2.h -- BLAKE2 Hash | ||
2 | 2015-06-30 : Igor Pavlov : Public domain | ||
3 | 2015 : Samuel Neves : Public domain */ | ||
4 | |||
5 | #ifndef __BLAKE2_H | ||
6 | #define __BLAKE2_H | ||
7 | |||
8 | #include "7zTypes.h" | ||
9 | |||
10 | EXTERN_C_BEGIN | ||
11 | |||
12 | #define BLAKE2S_BLOCK_SIZE 64 | ||
13 | #define BLAKE2S_DIGEST_SIZE 32 | ||
14 | #define BLAKE2SP_PARALLEL_DEGREE 8 | ||
15 | |||
16 | typedef struct | ||
17 | { | ||
18 | UInt32 h[8]; | ||
19 | UInt32 t[2]; | ||
20 | UInt32 f[2]; | ||
21 | Byte buf[BLAKE2S_BLOCK_SIZE]; | ||
22 | UInt32 bufPos; | ||
23 | UInt32 lastNode_f1; | ||
24 | UInt32 dummy[2]; /* for sizeof(CBlake2s) alignment */ | ||
25 | } CBlake2s; | ||
26 | |||
27 | /* You need to xor CBlake2s::h[i] with input parameter block after Blake2s_Init0() */ | ||
28 | /* | ||
29 | void Blake2s_Init0(CBlake2s *p); | ||
30 | void Blake2s_Update(CBlake2s *p, const Byte *data, size_t size); | ||
31 | void Blake2s_Final(CBlake2s *p, Byte *digest); | ||
32 | */ | ||
33 | |||
34 | |||
35 | typedef struct | ||
36 | { | ||
37 | CBlake2s S[BLAKE2SP_PARALLEL_DEGREE]; | ||
38 | unsigned bufPos; | ||
39 | } CBlake2sp; | ||
40 | |||
41 | |||
42 | void Blake2sp_Init(CBlake2sp *p); | ||
43 | void Blake2sp_Update(CBlake2sp *p, const Byte *data, size_t size); | ||
44 | void Blake2sp_Final(CBlake2sp *p, Byte *digest); | ||
45 | |||
46 | EXTERN_C_END | ||
47 | |||
48 | #endif | ||