xref: /PHP-8.1/ext/sodium/libsodium.stub.php (revision 10a2079b)
1<?php
2
3/** @generate-class-entries */
4
5function sodium_crypto_aead_aes256gcm_is_available(): bool {}
6
7#ifdef HAVE_AESGCM
8function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
9
10function sodium_crypto_aead_aes256gcm_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
11
12function sodium_crypto_aead_aes256gcm_keygen(): string {}
13#endif
14
15function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
16
17function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
18
19function sodium_crypto_aead_chacha20poly1305_keygen(): string {}
20
21function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
22
23function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
24
25function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {}
26
27#ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES
28function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
29
30function sodium_crypto_aead_xchacha20poly1305_ietf_keygen(): string {}
31
32function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
33#endif
34
35function sodium_crypto_auth(string $message, string $key): string {}
36
37function sodium_crypto_auth_keygen(): string {}
38
39function sodium_crypto_auth_verify(string $mac, string $message, string $key): bool {}
40
41function sodium_crypto_box(string $message, string $nonce, string $key_pair): string {}
42
43function sodium_crypto_box_keypair(): string {}
44
45function sodium_crypto_box_seed_keypair(string $seed): string {}
46
47function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
48
49function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false {}
50
51function sodium_crypto_box_publickey(string $key_pair): string {}
52
53function sodium_crypto_box_publickey_from_secretkey(string $secret_key): string {}
54
55function sodium_crypto_box_seal(string $message, string $public_key): string {}
56
57function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string|false {}
58
59function sodium_crypto_box_secretkey(string $key_pair): string {}
60
61#ifdef crypto_core_ristretto255_HASHBYTES
62function sodium_crypto_core_ristretto255_add(string $p, string $q): string {}
63
64function sodium_crypto_core_ristretto255_from_hash(string $s): string {}
65
66function sodium_crypto_core_ristretto255_is_valid_point(string $s): bool {}
67
68function sodium_crypto_core_ristretto255_random(): string {}
69
70function sodium_crypto_core_ristretto255_scalar_add(string $x, string $y): string {}
71
72function sodium_crypto_core_ristretto255_scalar_complement(string $s): string {}
73
74function sodium_crypto_core_ristretto255_scalar_invert(string $s): string {}
75
76function sodium_crypto_core_ristretto255_scalar_mul(string $x, string $y): string {}
77
78function sodium_crypto_core_ristretto255_scalar_negate(string $s): string {}
79
80function sodium_crypto_core_ristretto255_scalar_random(): string {}
81
82function sodium_crypto_core_ristretto255_scalar_reduce(string $s): string {}
83
84function sodium_crypto_core_ristretto255_scalar_sub(string $x, string $y): string {}
85
86function sodium_crypto_core_ristretto255_sub(string $p, string $q): string {}
87#endif
88
89function sodium_crypto_kx_keypair(): string {}
90
91function sodium_crypto_kx_publickey(string $key_pair): string {}
92
93function sodium_crypto_kx_secretkey(string $key_pair): string {}
94
95function sodium_crypto_kx_seed_keypair(string $seed): string {}
96
97/** @return array<int, string> */
98function sodium_crypto_kx_client_session_keys(string $client_key_pair, string $server_key): array {}
99
100/** @return array<int, string> */
101function sodium_crypto_kx_server_session_keys(string $server_key_pair, string $client_key): array {}
102
103function sodium_crypto_generichash(string $message, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
104
105function sodium_crypto_generichash_keygen(): string {}
106
107function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
108
109/** @return true */
110function sodium_crypto_generichash_update(string &$state, string $message): bool {}
111
112function sodium_crypto_generichash_final(string &$state, int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
113
114function sodium_crypto_kdf_derive_from_key(int $subkey_length, int $subkey_id, string $context, string $key): string {}
115
116function sodium_crypto_kdf_keygen(): string {}
117
118#ifdef crypto_pwhash_SALTBYTES
119function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $algo = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {}
120
121function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {}
122
123function sodium_crypto_pwhash_str_verify(string $hash, string $password): bool {}
124#endif
125
126#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
127function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool {}
128#endif
129
130#ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES
131function sodium_crypto_pwhash_scryptsalsa208sha256(int $length, string $password, string $salt, int $opslimit, int $memlimit): string {}
132
133function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string {}
134
135function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {}
136#endif
137
138function sodium_crypto_scalarmult(string $n, string $p): string {}
139
140#ifdef crypto_core_ristretto255_HASHBYTES
141function sodium_crypto_scalarmult_ristretto255(string $n, string $p): string {}
142
143function sodium_crypto_scalarmult_ristretto255_base(string $n): string {}
144#endif
145
146function sodium_crypto_secretbox(string $message, string $nonce, string $key): string {}
147
148function sodium_crypto_secretbox_keygen(): string {}
149
150function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false {}
151
152#ifdef crypto_secretstream_xchacha20poly1305_ABYTES
153function sodium_crypto_secretstream_xchacha20poly1305_keygen(): string {}
154
155/** @return array<int, string> */
156function sodium_crypto_secretstream_xchacha20poly1305_init_push(string $key): array {}
157
158function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $message, string $additional_data = "", int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {}
159
160function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $header, string $key): string {}
161
162/** @return array<int, int|string>|false */
163function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data = ""): array|false {}
164
165function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {}
166#endif
167
168function sodium_crypto_shorthash(string $message, string $key): string {}
169
170function sodium_crypto_shorthash_keygen(): string {}
171
172function sodium_crypto_sign(string $message, string $secret_key): string {}
173
174function sodium_crypto_sign_detached(string $message, string $secret_key): string {}
175
176function sodium_crypto_sign_ed25519_pk_to_curve25519(string $public_key): string {}
177
178function sodium_crypto_sign_ed25519_sk_to_curve25519(string $secret_key): string {}
179
180function sodium_crypto_sign_keypair(): string {}
181
182function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
183
184function sodium_crypto_sign_open(string $signed_message, string $public_key): string|false {}
185
186function sodium_crypto_sign_publickey(string $key_pair): string {}
187
188function sodium_crypto_sign_secretkey(string $key_pair): string {}
189
190function sodium_crypto_sign_publickey_from_secretkey(string $secret_key): string {}
191
192function sodium_crypto_sign_seed_keypair(string $seed): string {}
193
194function sodium_crypto_sign_verify_detached(string $signature, string $message, string $public_key): bool {}
195
196function sodium_crypto_stream(int $length, string $nonce, string $key): string {}
197
198function sodium_crypto_stream_keygen(): string {}
199
200function sodium_crypto_stream_xor(string $message, string $nonce, string $key): string {}
201
202#if defined(crypto_stream_xchacha20_KEYBYTES)
203function sodium_crypto_stream_xchacha20(int $length, string $nonce, string $key): string {}
204
205function sodium_crypto_stream_xchacha20_keygen(): string {}
206
207function sodium_crypto_stream_xchacha20_xor(string $message, string $nonce, string $key): string {}
208#endif
209
210function sodium_add(string &$string1, string $string2): void {}
211
212function sodium_compare(string $string1, string $string2): int {}
213
214function sodium_increment(string &$string): void {}
215
216function sodium_memcmp(string $string1, string $string2): int {}
217
218function sodium_memzero(string &$string): void {}
219
220function sodium_pad(string $string, int $block_size): string {}
221
222function sodium_unpad(string $string, int $block_size): string {}
223
224function sodium_bin2hex(string $string): string {}
225
226function sodium_hex2bin(string $string, string $ignore = ""): string {}
227
228#ifdef sodium_base64_VARIANT_ORIGINAL
229function sodium_bin2base64(string $string, int $id): string {}
230
231function sodium_base642bin(string $string, int $id, string $ignore = ""): string {}
232#endif
233
234/** @alias sodium_crypto_box_publickey_from_secretkey */
235function sodium_crypto_scalarmult_base(string $secret_key): string {}
236
237class SodiumException extends Exception {}
238