- Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathphp_hash_xxhash.h
73 lines (58 loc) · 3.45 KB
/
php_hash_xxhash.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| https://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Anatol Belski <ab@php.net> |
+----------------------------------------------------------------------+
*/
#ifndefPHP_HASH_XXHASH_H
#definePHP_HASH_XXHASH_H
#defineXXH_INLINE_ALL 1
#include"xxhash/xxhash.h"
typedefstruct {
XXH32_state_ts;
} PHP_XXH32_CTX;
#definePHP_XXH32_SPEC "llllllllllll"
PHP_HASH_APIvoidPHP_XXH32Init(PHP_XXH32_CTX*ctx, HashTable*args);
PHP_HASH_APIvoidPHP_XXH32Update(PHP_XXH32_CTX*ctx, constunsigned char*in, size_tlen);
PHP_HASH_APIvoidPHP_XXH32Final(unsigned chardigest[4], PHP_XXH32_CTX*ctx);
PHP_HASH_APIzend_resultPHP_XXH32Copy(constphp_hash_ops*ops, constPHP_XXH32_CTX*orig_context, PHP_XXH32_CTX*copy_context);
typedefstruct {
XXH64_state_ts;
} PHP_XXH64_CTX;
#definePHP_XXH64_SPEC "qqqqqqqqqllq"
PHP_HASH_APIvoidPHP_XXH64Init(PHP_XXH64_CTX*ctx, HashTable*args);
PHP_HASH_APIvoidPHP_XXH64Update(PHP_XXH64_CTX*ctx, constunsigned char*in, size_tlen);
PHP_HASH_APIvoidPHP_XXH64Final(unsigned chardigest[8], PHP_XXH64_CTX*ctx);
PHP_HASH_APIzend_resultPHP_XXH64Copy(constphp_hash_ops*ops, constPHP_XXH64_CTX*orig_context, PHP_XXH64_CTX*copy_context);
#definePHP_XXH3_SECRET_SIZE_MIN XXH3_SECRET_SIZE_MIN
#definePHP_XXH3_SECRET_SIZE_MAX 256
typedefstruct {
XXH3_state_ts;
/* The value must survive the whole streaming cycle from init to final.
A more flexible mechanism would be to carry zend_string* passed through
the options. However, that will require to introduce a destructor
handler for ctx, so then it wolud be automatically called from the
object destructor. Until that is given, the viable way is to use a
plausible max secret length. */
constunsigned charsecret[PHP_XXH3_SECRET_SIZE_MAX];
} PHP_XXH3_CTX;
typedefPHP_XXH3_CTXPHP_XXH3_64_CTX;
PHP_HASH_APIvoidPHP_XXH3_64_Init(PHP_XXH3_64_CTX*ctx, HashTable*args);
PHP_HASH_APIvoidPHP_XXH3_64_Update(PHP_XXH3_64_CTX*ctx, constunsigned char*in, size_tlen);
PHP_HASH_APIvoidPHP_XXH3_64_Final(unsigned chardigest[8], PHP_XXH3_64_CTX*ctx);
PHP_HASH_APIzend_resultPHP_XXH3_64_Copy(constphp_hash_ops*ops, constPHP_XXH3_64_CTX*orig_context, PHP_XXH3_64_CTX*copy_context);
typedefPHP_XXH3_CTXPHP_XXH3_128_CTX;
PHP_HASH_APIvoidPHP_XXH3_128_Init(PHP_XXH3_128_CTX*ctx, HashTable*args);
PHP_HASH_APIvoidPHP_XXH3_128_Update(PHP_XXH3_128_CTX*ctx, constunsigned char*in, size_tlen);
PHP_HASH_APIvoidPHP_XXH3_128_Final(unsigned chardigest[16], PHP_XXH3_128_CTX*ctx);
PHP_HASH_APIzend_resultPHP_XXH3_128_Copy(constphp_hash_ops*ops, constPHP_XXH3_128_CTX*orig_context, PHP_XXH3_128_CTX*copy_context);
#endif/* PHP_HASH_XXHASH_H */