php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_hash_xxhash.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Author: Anatol Belski <ab@php.net> |
14 +----------------------------------------------------------------------+
15*/
16
17#ifndef PHP_HASH_XXHASH_H
18#define PHP_HASH_XXHASH_H
19
20#define XXH_INLINE_ALL 1
21#include "xxhash/xxhash.h"
22
23typedef struct {
26#define PHP_XXH32_SPEC "llllllllllll"
27
29PHP_HASH_API void PHP_XXH32Update(PHP_XXH32_CTX *ctx, const unsigned char *in, size_t len);
30PHP_HASH_API void PHP_XXH32Final(unsigned char digest[4], PHP_XXH32_CTX *ctx);
31PHP_HASH_API zend_result PHP_XXH32Copy(const php_hash_ops *ops, const PHP_XXH32_CTX *orig_context, PHP_XXH32_CTX *copy_context);
32
33typedef struct {
36#define PHP_XXH64_SPEC "qqqqqqqqqllq"
37
39PHP_HASH_API void PHP_XXH64Update(PHP_XXH64_CTX *ctx, const unsigned char *in, size_t len);
40PHP_HASH_API void PHP_XXH64Final(unsigned char digest[8], PHP_XXH64_CTX *ctx);
41PHP_HASH_API zend_result PHP_XXH64Copy(const php_hash_ops *ops, const PHP_XXH64_CTX *orig_context, PHP_XXH64_CTX *copy_context);
42
43#define PHP_XXH3_SECRET_SIZE_MIN XXH3_SECRET_SIZE_MIN
44#define PHP_XXH3_SECRET_SIZE_MAX 256
45
46typedef struct {
48 /* The value must survive the whole streaming cycle from init to final.
49
50 A more flexible mechanism would be to carry zend_string* passed through
51 the options. However, that will require to introduce a destructor
52 handler for ctx, so then it wolud be automatically called from the
53 object destructor. Until that is given, the viable way is to use a
54 plausible max secret length. */
55 const unsigned char secret[PHP_XXH3_SECRET_SIZE_MAX];
57
59
61PHP_HASH_API void PHP_XXH3_64_Update(PHP_XXH3_64_CTX *ctx, const unsigned char *in, size_t len);
62PHP_HASH_API void PHP_XXH3_64_Final(unsigned char digest[8], PHP_XXH3_64_CTX *ctx);
64
66
68PHP_HASH_API void PHP_XXH3_128_Update(PHP_XXH3_128_CTX *ctx, const unsigned char *in, size_t len);
69PHP_HASH_API void PHP_XXH3_128_Final(unsigned char digest[16], PHP_XXH3_128_CTX *ctx);
71
72#endif /* PHP_HASH_XXHASH_H */
73
size_t len
Definition apprentice.c:174
const php_stream_filter_ops * ops
Definition filters.c:1899
struct XXH32_state_s XXH32_state_t
The opaque state struct for the XXH32 streaming API.
Definition xxhash.h:473
struct XXH3_state_s XXH3_state_t
The state struct for the XXH3 streaming API.
Definition xxhash.h:836
struct XXH64_state_s XXH64_state_t
The opaque state struct for the XXH64 streaming API.
Definition xxhash.h:717
#define PHP_HASH_API
Definition php_hash.h:144
struct _php_hash_ops php_hash_ops
PHP_HASH_API void PHP_XXH3_128_Init(PHP_XXH3_128_CTX *ctx, HashTable *args)
PHP_HASH_API void PHP_XXH64Init(PHP_XXH64_CTX *ctx, HashTable *args)
PHP_XXH3_CTX PHP_XXH3_64_CTX
PHP_HASH_API zend_result PHP_XXH32Copy(const php_hash_ops *ops, const PHP_XXH32_CTX *orig_context, PHP_XXH32_CTX *copy_context)
Definition hash_xxhash.c:72
PHP_HASH_API void PHP_XXH64Update(PHP_XXH64_CTX *ctx, const unsigned char *in, size_t len)
PHP_HASH_API void PHP_XXH3_128_Update(PHP_XXH3_128_CTX *ctx, const unsigned char *in, size_t len)
PHP_HASH_API zend_result PHP_XXH64Copy(const php_hash_ops *ops, const PHP_XXH64_CTX *orig_context, PHP_XXH64_CTX *copy_context)
PHP_HASH_API zend_result PHP_XXH3_128_Copy(const php_hash_ops *ops, const PHP_XXH3_128_CTX *orig_context, PHP_XXH3_128_CTX *copy_context)
PHP_HASH_API void PHP_XXH3_64_Update(PHP_XXH3_64_CTX *ctx, const unsigned char *in, size_t len)
PHP_HASH_API zend_result PHP_XXH3_64_Copy(const php_hash_ops *ops, const PHP_XXH3_64_CTX *orig_context, PHP_XXH3_64_CTX *copy_context)
#define PHP_XXH3_SECRET_SIZE_MAX
PHP_XXH3_CTX PHP_XXH3_128_CTX
PHP_HASH_API void PHP_XXH64Final(unsigned char digest[8], PHP_XXH64_CTX *ctx)
PHP_HASH_API void PHP_XXH32Init(PHP_XXH32_CTX *ctx, HashTable *args)
Definition hash_xxhash.c:40
PHP_HASH_API void PHP_XXH32Update(PHP_XXH32_CTX *ctx, const unsigned char *in, size_t len)
Definition hash_xxhash.c:62
PHP_HASH_API void PHP_XXH3_64_Init(PHP_XXH3_64_CTX *ctx, HashTable *args)
PHP_HASH_API void PHP_XXH3_128_Final(unsigned char digest[16], PHP_XXH3_128_CTX *ctx)
PHP_HASH_API void PHP_XXH32Final(unsigned char digest[4], PHP_XXH32_CTX *ctx)
Definition hash_xxhash.c:67
PHP_HASH_API void PHP_XXH3_64_Final(unsigned char digest[8], PHP_XXH3_64_CTX *ctx)
XXH32_state_t s
XXH3_state_t s
const unsigned char secret[PHP_XXH3_SECRET_SIZE_MAX]
XXH64_state_t s
zval * args
struct _zend_array HashTable
Definition zend_types.h:386
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64