xref: /PHP-8.2/ext/hash/hash.stub.php (revision e8c9c731)
1<?php
2
3/** @generate-class-entries */
4
5/**
6 * @var int
7 * @cvalue PHP_HASH_HMAC
8 */
9const HASH_HMAC = UNKNOWN;
10
11/** @refcount 1 */
12function hash(string $algo, string $data, bool $binary = false, array $options = []): string {}
13
14/** @refcount 1 */
15function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {}
16
17/**
18 * @refcount 1
19 */
20function hash_hmac(string $algo, string $data, #[\SensitiveParameter] string $key, bool $binary = false): string {}
21
22/**
23 * @refcount 1
24 */
25function hash_hmac_file(string $algo, string $filename, #[\SensitiveParameter] string $key, bool $binary = false): string|false {}
26
27/**
28 * @refcount 1
29 */
30function hash_init(string $algo, int $flags = 0, #[\SensitiveParameter] string $key = "", array $options = []): HashContext {}
31
32function hash_update(HashContext $context, string $data): bool {}
33
34/** @param resource $stream */
35function hash_update_stream(HashContext $context, $stream, int $length = -1): int {}
36
37/** @param resource|null $stream_context */
38function hash_update_file(HashContext $context, string $filename, $stream_context = null): bool {}
39
40/** @refcount 1 */
41function hash_final(HashContext $context, bool $binary = false): string {}
42
43/** @refcount 1 */
44function hash_copy(HashContext $context): HashContext {}
45
46/**
47 * @return array<int, string>
48 * @refcount 1
49 */
50function hash_algos(): array {}
51
52/**
53 * @return array<int, string>
54 * @refcount 1
55 */
56function hash_hmac_algos(): array {}
57
58/**
59 * @refcount 1
60 */
61function hash_pbkdf2(string $algo, #[\SensitiveParameter] string $password, string $salt, int $iterations, int $length = 0, bool $binary = false, array $options = []): string {}
62
63function hash_equals(#[\SensitiveParameter] string $known_string, #[\SensitiveParameter] string $user_string): bool {}
64
65/**
66 * @refcount 1
67 */
68function hash_hkdf(string $algo, #[\SensitiveParameter] string $key, int $length = 0, string $info = "", string $salt = ""): string {}
69
70#ifdef PHP_MHASH_BC
71/** @deprecated */
72function mhash_get_block_size(int $algo): int|false {}
73
74/**
75 * @refcount 1
76 * @deprecated
77 */
78function mhash_get_hash_name(int $algo): string|false {}
79
80/**
81 * @refcount 1
82 * @deprecated
83 */
84function mhash_keygen_s2k(int $algo, string $password, string $salt, int $length): string|false {}
85
86/** @deprecated */
87function mhash_count(): int {}
88
89/**
90 * @refcount 1
91 * @deprecated
92 */
93function mhash(int $algo, string $data, ?string $key = null): string|false {}
94#endif
95
96final class HashContext
97{
98    private function __construct() {}
99
100    public function __serialize(): array {}
101
102    public function __unserialize(array $data): void {}
103}
104