xref: /PHP-8.0/ext/sodium/libsodium.stub.php (revision 0c57ebb1)
1<?php
2
3/** @generate-function-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
61function sodium_crypto_kx_keypair(): string {}
62
63function sodium_crypto_kx_publickey(string $key_pair): string {}
64
65function sodium_crypto_kx_secretkey(string $key_pair): string {}
66
67function sodium_crypto_kx_seed_keypair(string $seed): string {}
68
69function sodium_crypto_kx_client_session_keys(string $client_key_pair, string $server_key): array {}
70
71function sodium_crypto_kx_server_session_keys(string $server_key_pair, string $client_key): array {}
72
73function sodium_crypto_generichash(string $message, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
74
75function sodium_crypto_generichash_keygen(): string {}
76
77function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
78
79function sodium_crypto_generichash_update(string &$state, string $message): bool {}
80
81function sodium_crypto_generichash_final(string &$state, int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
82
83function sodium_crypto_kdf_derive_from_key(int $subkey_length, int $subkey_id, string $context, string $key): string {}
84
85function sodium_crypto_kdf_keygen(): string {}
86
87#ifdef crypto_pwhash_SALTBYTES
88function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $algo = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {}
89
90function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {}
91
92function sodium_crypto_pwhash_str_verify(string $hash, string $password): bool {}
93#endif
94
95#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
96function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool {}
97#endif
98
99#ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES
100function sodium_crypto_pwhash_scryptsalsa208sha256(int $length, string $password, string $salt, int $opslimit, int $memlimit): string {}
101
102function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string {}
103
104function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {}
105#endif
106
107function sodium_crypto_scalarmult(string $n, string $p): string {}
108
109function sodium_crypto_secretbox(string $message, string $nonce, string $key): string {}
110
111function sodium_crypto_secretbox_keygen(): string {}
112
113function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false {}
114
115#ifdef crypto_secretstream_xchacha20poly1305_ABYTES
116function sodium_crypto_secretstream_xchacha20poly1305_keygen(): string {}
117
118function sodium_crypto_secretstream_xchacha20poly1305_init_push(string $key): array {}
119
120function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $message, string $additional_data  = "", int $tag  = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {}
121
122function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $header, string $key): string {}
123
124function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data  = ""): array|false {}
125
126function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {}
127#endif
128
129function sodium_crypto_shorthash(string $message, string $key): string {}
130
131function sodium_crypto_shorthash_keygen(): string {}
132
133function sodium_crypto_sign(string $message, string $secret_key): string {}
134
135function sodium_crypto_sign_detached(string $message, string $secret_key): string {}
136
137function sodium_crypto_sign_ed25519_pk_to_curve25519(string $public_key): string {}
138
139function sodium_crypto_sign_ed25519_sk_to_curve25519(string $secret_key): string {}
140
141function sodium_crypto_sign_keypair(): string {}
142
143function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
144
145function sodium_crypto_sign_open(string $signed_message, string $public_key): string|false {}
146
147function sodium_crypto_sign_publickey(string $key_pair): string {}
148
149function sodium_crypto_sign_secretkey(string $key_pair): string {}
150
151function sodium_crypto_sign_publickey_from_secretkey(string $secret_key): string {}
152
153function sodium_crypto_sign_seed_keypair(string $seed): string {}
154
155function sodium_crypto_sign_verify_detached(string $signature, string $message, string $public_key): bool {}
156
157function sodium_crypto_stream(int $length, string $nonce, string $key): string {}
158
159function sodium_crypto_stream_keygen(): string {}
160
161function sodium_crypto_stream_xor(string $message, string $nonce, string $key): string {}
162
163function sodium_add(string &$string1, string $string2): void {}
164
165function sodium_compare(string $string1, string $string2): int {}
166
167function sodium_increment(string &$string): void {}
168
169function sodium_memcmp(string $string1, string $string2): int {}
170
171function sodium_memzero(string &$string): void {}
172
173function sodium_pad(string $string, int $block_size): string {}
174
175function sodium_unpad(string $string, int $block_size): string {}
176
177function sodium_bin2hex(string $string): string {}
178
179function sodium_hex2bin(string $string, string $ignore = ""): string {}
180
181#ifdef sodium_base64_VARIANT_ORIGINAL
182function sodium_bin2base64(string $string, int $id): string {}
183
184function sodium_base642bin(string $string, int $id, string $ignore  = ""): string {}
185#endif
186
187/** @alias sodium_crypto_box_publickey_from_secretkey */
188function sodium_crypto_scalarmult_base(string $secret_key): string {}
189
190class SodiumException extends Exception {}
191