author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:52:52 +0200 | |
changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
9 | 1 |
<?php |
2 |
||
16 | 3 |
require_once dirname(dirname(__FILE__)) . '/autoload.php'; |
4 |
||
9 | 5 |
/** |
6 |
* This file will monkey patch the pure-PHP implementation in place of the |
|
7 |
* PECL functions and constants, but only if they do not already exist. |
|
8 |
* |
|
9 |
* Thus, the functions or constants just proxy to the appropriate |
|
10 |
* ParagonIE_Sodium_Compat method or class constant, respectively. |
|
11 |
*/ |
|
12 |
foreach (array( |
|
16 | 13 |
'BASE64_VARIANT_ORIGINAL', |
14 |
'BASE64_VARIANT_ORIGINAL_NO_PADDING', |
|
15 |
'BASE64_VARIANT_URLSAFE', |
|
16 |
'BASE64_VARIANT_URLSAFE_NO_PADDING', |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
17 |
'CRYPTO_AEAD_AES256GCM_KEYBYTES', |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
18 |
'CRYPTO_AEAD_AES256GCM_NSECBYTES', |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
19 |
'CRYPTO_AEAD_AES256GCM_NPUBBYTES', |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
20 |
'CRYPTO_AEAD_AES256GCM_ABYTES', |
9 | 21 |
'CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES', |
22 |
'CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES', |
|
23 |
'CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES', |
|
24 |
'CRYPTO_AEAD_CHACHA20POLY1305_ABYTES', |
|
25 |
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES', |
|
26 |
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES', |
|
27 |
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES', |
|
28 |
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES', |
|
18 | 29 |
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES', |
30 |
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES', |
|
31 |
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES', |
|
32 |
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES', |
|
9 | 33 |
'CRYPTO_AUTH_BYTES', |
34 |
'CRYPTO_AUTH_KEYBYTES', |
|
35 |
'CRYPTO_BOX_SEALBYTES', |
|
36 |
'CRYPTO_BOX_SECRETKEYBYTES', |
|
37 |
'CRYPTO_BOX_PUBLICKEYBYTES', |
|
38 |
'CRYPTO_BOX_KEYPAIRBYTES', |
|
39 |
'CRYPTO_BOX_MACBYTES', |
|
40 |
'CRYPTO_BOX_NONCEBYTES', |
|
41 |
'CRYPTO_BOX_SEEDBYTES', |
|
16 | 42 |
'CRYPTO_KDF_BYTES_MIN', |
43 |
'CRYPTO_KDF_BYTES_MAX', |
|
44 |
'CRYPTO_KDF_CONTEXTBYTES', |
|
45 |
'CRYPTO_KDF_KEYBYTES', |
|
9 | 46 |
'CRYPTO_KX_BYTES', |
16 | 47 |
'CRYPTO_KX_KEYPAIRBYTES', |
48 |
'CRYPTO_KX_PRIMITIVE', |
|
9 | 49 |
'CRYPTO_KX_SEEDBYTES', |
50 |
'CRYPTO_KX_PUBLICKEYBYTES', |
|
51 |
'CRYPTO_KX_SECRETKEYBYTES', |
|
16 | 52 |
'CRYPTO_KX_SESSIONKEYBYTES', |
9 | 53 |
'CRYPTO_GENERICHASH_BYTES', |
54 |
'CRYPTO_GENERICHASH_BYTES_MIN', |
|
55 |
'CRYPTO_GENERICHASH_BYTES_MAX', |
|
56 |
'CRYPTO_GENERICHASH_KEYBYTES', |
|
57 |
'CRYPTO_GENERICHASH_KEYBYTES_MIN', |
|
58 |
'CRYPTO_GENERICHASH_KEYBYTES_MAX', |
|
59 |
'CRYPTO_PWHASH_SALTBYTES', |
|
60 |
'CRYPTO_PWHASH_STRPREFIX', |
|
61 |
'CRYPTO_PWHASH_ALG_ARGON2I13', |
|
62 |
'CRYPTO_PWHASH_ALG_ARGON2ID13', |
|
63 |
'CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE', |
|
64 |
'CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE', |
|
65 |
'CRYPTO_PWHASH_MEMLIMIT_MODERATE', |
|
66 |
'CRYPTO_PWHASH_OPSLIMIT_MODERATE', |
|
67 |
'CRYPTO_PWHASH_MEMLIMIT_SENSITIVE', |
|
68 |
'CRYPTO_PWHASH_OPSLIMIT_SENSITIVE', |
|
18 | 69 |
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES', |
70 |
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX', |
|
71 |
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE', |
|
72 |
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE', |
|
73 |
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE', |
|
74 |
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE', |
|
9 | 75 |
'CRYPTO_SCALARMULT_BYTES', |
76 |
'CRYPTO_SCALARMULT_SCALARBYTES', |
|
77 |
'CRYPTO_SHORTHASH_BYTES', |
|
78 |
'CRYPTO_SHORTHASH_KEYBYTES', |
|
79 |
'CRYPTO_SECRETBOX_KEYBYTES', |
|
80 |
'CRYPTO_SECRETBOX_MACBYTES', |
|
81 |
'CRYPTO_SECRETBOX_NONCEBYTES', |
|
16 | 82 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES', |
83 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES', |
|
84 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES', |
|
85 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH', |
|
86 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL', |
|
87 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY', |
|
88 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL', |
|
89 |
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX', |
|
9 | 90 |
'CRYPTO_SIGN_BYTES', |
91 |
'CRYPTO_SIGN_SEEDBYTES', |
|
92 |
'CRYPTO_SIGN_PUBLICKEYBYTES', |
|
93 |
'CRYPTO_SIGN_SECRETKEYBYTES', |
|
94 |
'CRYPTO_SIGN_KEYPAIRBYTES', |
|
95 |
'CRYPTO_STREAM_KEYBYTES', |
|
96 |
'CRYPTO_STREAM_NONCEBYTES', |
|
18 | 97 |
'CRYPTO_STREAM_XCHACHA20_KEYBYTES', |
98 |
'CRYPTO_STREAM_XCHACHA20_NONCEBYTES', |
|
99 |
'LIBRARY_MAJOR_VERSION', |
|
100 |
'LIBRARY_MINOR_VERSION', |
|
9 | 101 |
'LIBRARY_VERSION_MAJOR', |
102 |
'LIBRARY_VERSION_MINOR', |
|
103 |
'VERSION_STRING' |
|
104 |
) as $constant |
|
105 |
) { |
|
16 | 106 |
if (!defined("SODIUM_$constant") && defined("ParagonIE_Sodium_Compat::$constant")) { |
9 | 107 |
define("SODIUM_$constant", constant("ParagonIE_Sodium_Compat::$constant")); |
108 |
} |
|
109 |
} |
|
16 | 110 |
if (!is_callable('sodium_add')) { |
111 |
/** |
|
112 |
* @see ParagonIE_Sodium_Compat::add() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
113 |
* @param string $string1 |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
114 |
* @param string $string2 |
16 | 115 |
* @return void |
116 |
* @throws SodiumException |
|
117 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
118 |
function sodium_add( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
119 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
120 |
&$string1, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
121 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
122 |
$string2 |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
123 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
124 |
ParagonIE_Sodium_Compat::add($string1, $string2); |
16 | 125 |
} |
126 |
} |
|
127 |
if (!is_callable('sodium_base642bin')) { |
|
128 |
/** |
|
129 |
* @see ParagonIE_Sodium_Compat::bin2base64() |
|
130 |
* @param string $string |
|
131 |
* @param int $variant |
|
132 |
* @param string $ignore |
|
133 |
* @return string |
|
134 |
* @throws SodiumException |
|
135 |
* @throws TypeError |
|
136 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
137 |
function sodium_base642bin( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
138 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
139 |
$string, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
140 |
$variant, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
141 |
$ignore ='' |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
142 |
) { |
16 | 143 |
return ParagonIE_Sodium_Compat::base642bin($string, $variant, $ignore); |
144 |
} |
|
145 |
} |
|
146 |
if (!is_callable('sodium_bin2base64')) { |
|
147 |
/** |
|
148 |
* @see ParagonIE_Sodium_Compat::bin2base64() |
|
149 |
* @param string $string |
|
150 |
* @param int $variant |
|
151 |
* @return string |
|
152 |
* @throws SodiumException |
|
153 |
* @throws TypeError |
|
154 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
155 |
function sodium_bin2base64( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
156 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
157 |
$string, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
158 |
$variant |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
159 |
) { |
16 | 160 |
return ParagonIE_Sodium_Compat::bin2base64($string, $variant); |
161 |
} |
|
162 |
} |
|
9 | 163 |
if (!is_callable('sodium_bin2hex')) { |
164 |
/** |
|
165 |
* @see ParagonIE_Sodium_Compat::hex2bin() |
|
166 |
* @param string $string |
|
167 |
* @return string |
|
168 |
* @throws SodiumException |
|
169 |
* @throws TypeError |
|
170 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
171 |
function sodium_bin2hex( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
172 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
173 |
$string |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
174 |
) { |
9 | 175 |
return ParagonIE_Sodium_Compat::bin2hex($string); |
176 |
} |
|
177 |
} |
|
178 |
if (!is_callable('sodium_compare')) { |
|
179 |
/** |
|
180 |
* @see ParagonIE_Sodium_Compat::compare() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
181 |
* @param string $string1 |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
182 |
* @param string $string2 |
9 | 183 |
* @return int |
184 |
* @throws SodiumException |
|
185 |
* @throws TypeError |
|
186 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
187 |
function sodium_compare( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
188 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
189 |
$string1, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
190 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
191 |
$string2 |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
192 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
193 |
return ParagonIE_Sodium_Compat::compare($string1, $string2); |
9 | 194 |
} |
195 |
} |
|
196 |
if (!is_callable('sodium_crypto_aead_aes256gcm_decrypt')) { |
|
197 |
/** |
|
198 |
* @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
199 |
* @param string $ciphertext |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
200 |
* @param string $additional_data |
9 | 201 |
* @param string $nonce |
202 |
* @param string $key |
|
203 |
* @return string|bool |
|
204 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
205 |
function sodium_crypto_aead_aes256gcm_decrypt( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
206 |
$ciphertext, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
207 |
$additional_data, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
208 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
209 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
210 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
211 |
) { |
9 | 212 |
try { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
213 |
return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
214 |
$ciphertext, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
215 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
216 |
$nonce, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
217 |
$key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
218 |
); |
9 | 219 |
} catch (Error $ex) { |
220 |
return false; |
|
221 |
} catch (Exception $ex) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
222 |
if (($ex instanceof SodiumException) && ($ex->getMessage() === 'AES-256-GCM is not available')) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
223 |
throw $ex; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
224 |
} |
9 | 225 |
return false; |
226 |
} |
|
227 |
} |
|
228 |
} |
|
229 |
if (!is_callable('sodium_crypto_aead_aes256gcm_encrypt')) { |
|
230 |
/** |
|
231 |
* @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt() |
|
232 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
233 |
* @param string $additional_data |
9 | 234 |
* @param string $nonce |
235 |
* @param string $key |
|
236 |
* @return string |
|
237 |
* @throws SodiumException |
|
238 |
* @throws TypeError |
|
239 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
240 |
function sodium_crypto_aead_aes256gcm_encrypt( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
241 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
242 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
243 |
$additional_data, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
244 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
245 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
246 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
247 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
248 |
return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $additional_data, $nonce, $key); |
9 | 249 |
} |
250 |
} |
|
251 |
if (!is_callable('sodium_crypto_aead_aes256gcm_is_available')) { |
|
252 |
/** |
|
253 |
* @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available() |
|
254 |
* @return bool |
|
255 |
*/ |
|
256 |
function sodium_crypto_aead_aes256gcm_is_available() |
|
257 |
{ |
|
258 |
return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available(); |
|
259 |
} |
|
260 |
} |
|
261 |
if (!is_callable('sodium_crypto_aead_chacha20poly1305_decrypt')) { |
|
262 |
/** |
|
263 |
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
264 |
* @param string $ciphertext |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
265 |
* @param string $additional_data |
9 | 266 |
* @param string $nonce |
267 |
* @param string $key |
|
268 |
* @return string|bool |
|
269 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
270 |
function sodium_crypto_aead_chacha20poly1305_decrypt( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
271 |
$ciphertext, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
272 |
$additional_data, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
273 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
274 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
275 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
276 |
) { |
9 | 277 |
try { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
278 |
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
279 |
$ciphertext, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
280 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
281 |
$nonce, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
282 |
$key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
283 |
); |
9 | 284 |
} catch (Error $ex) { |
285 |
return false; |
|
286 |
} catch (Exception $ex) { |
|
287 |
return false; |
|
288 |
} |
|
289 |
} |
|
290 |
} |
|
291 |
if (!is_callable('sodium_crypto_aead_chacha20poly1305_encrypt')) { |
|
292 |
/** |
|
293 |
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt() |
|
294 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
295 |
* @param string $additional_data |
9 | 296 |
* @param string $nonce |
297 |
* @param string $key |
|
298 |
* @return string |
|
299 |
* @throws SodiumException |
|
300 |
* @throws TypeError |
|
301 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
302 |
function sodium_crypto_aead_chacha20poly1305_encrypt( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
303 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
304 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
305 |
$additional_data, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
306 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
307 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
308 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
309 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
310 |
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
311 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
312 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
313 |
$nonce, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
314 |
$key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
315 |
); |
9 | 316 |
} |
317 |
} |
|
318 |
if (!is_callable('sodium_crypto_aead_chacha20poly1305_keygen')) { |
|
319 |
/** |
|
320 |
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen() |
|
321 |
* @return string |
|
16 | 322 |
* @throws Exception |
9 | 323 |
*/ |
324 |
function sodium_crypto_aead_chacha20poly1305_keygen() |
|
325 |
{ |
|
326 |
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen(); |
|
327 |
} |
|
328 |
} |
|
329 |
if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_decrypt')) { |
|
330 |
/** |
|
331 |
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt() |
|
332 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
333 |
* @param string $additional_data |
9 | 334 |
* @param string $nonce |
335 |
* @param string $key |
|
336 |
* @return string|bool |
|
337 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
338 |
function sodium_crypto_aead_chacha20poly1305_ietf_decrypt( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
339 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
340 |
$additional_data, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
341 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
342 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
343 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
344 |
) { |
9 | 345 |
try { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
346 |
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
347 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
348 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
349 |
$nonce, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
350 |
$key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
351 |
); |
9 | 352 |
} catch (Error $ex) { |
353 |
return false; |
|
354 |
} catch (Exception $ex) { |
|
355 |
return false; |
|
356 |
} |
|
357 |
} |
|
358 |
} |
|
359 |
if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_encrypt')) { |
|
360 |
/** |
|
361 |
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt() |
|
362 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
363 |
* @param string $additional_data |
9 | 364 |
* @param string $nonce |
365 |
* @param string $key |
|
366 |
* @return string |
|
367 |
* @throws SodiumException |
|
368 |
* @throws TypeError |
|
369 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
370 |
function sodium_crypto_aead_chacha20poly1305_ietf_encrypt( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
371 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
372 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
373 |
$additional_data, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
374 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
375 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
376 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
377 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
378 |
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
379 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
380 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
381 |
$nonce, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
382 |
$key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
383 |
); |
9 | 384 |
} |
385 |
} |
|
386 |
if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_keygen')) { |
|
387 |
/** |
|
388 |
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen() |
|
389 |
* @return string |
|
16 | 390 |
* @throws Exception |
9 | 391 |
*/ |
392 |
function sodium_crypto_aead_chacha20poly1305_ietf_keygen() |
|
393 |
{ |
|
394 |
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen(); |
|
395 |
} |
|
396 |
} |
|
397 |
if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt')) { |
|
398 |
/** |
|
399 |
* @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
400 |
* @param string $ciphertext |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
401 |
* @param string $additional_data |
9 | 402 |
* @param string $nonce |
403 |
* @param string $key |
|
404 |
* @return string|bool |
|
405 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
406 |
function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
407 |
$ciphertext, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
408 |
$additional_data, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
409 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
410 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
411 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
412 |
) { |
9 | 413 |
try { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
414 |
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
415 |
$ciphertext, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
416 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
417 |
$nonce, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
418 |
$key, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
419 |
true |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
420 |
); |
9 | 421 |
} catch (Error $ex) { |
422 |
return false; |
|
423 |
} catch (Exception $ex) { |
|
424 |
return false; |
|
425 |
} |
|
426 |
} |
|
427 |
} |
|
428 |
if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')) { |
|
429 |
/** |
|
430 |
* @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt() |
|
431 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
432 |
* @param string $additional_data |
9 | 433 |
* @param string $nonce |
434 |
* @param string $key |
|
435 |
* @return string |
|
436 |
* @throws SodiumException |
|
437 |
* @throws TypeError |
|
438 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
439 |
function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt( |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
440 |
#[\SensitiveParameter] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
441 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
442 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
443 |
$nonce, |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
444 |
#[\SensitiveParameter] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
445 |
$key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
446 |
) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
447 |
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
448 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
449 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
450 |
$nonce, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
451 |
$key, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
452 |
true |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
453 |
); |
9 | 454 |
} |
455 |
} |
|
456 |
if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_keygen')) { |
|
457 |
/** |
|
458 |
* @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen() |
|
459 |
* @return string |
|
16 | 460 |
* @throws Exception |
9 | 461 |
*/ |
462 |
function sodium_crypto_aead_xchacha20poly1305_ietf_keygen() |
|
463 |
{ |
|
464 |
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen(); |
|
465 |
} |
|
466 |
} |
|
467 |
if (!is_callable('sodium_crypto_auth')) { |
|
468 |
/** |
|
469 |
* @see ParagonIE_Sodium_Compat::crypto_auth() |
|
470 |
* @param string $message |
|
471 |
* @param string $key |
|
472 |
* @return string |
|
473 |
* @throws SodiumException |
|
474 |
* @throws TypeError |
|
475 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
476 |
function sodium_crypto_auth( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
477 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
478 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
479 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
480 |
) { |
9 | 481 |
return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
482 |
} |
|
483 |
} |
|
484 |
if (!is_callable('sodium_crypto_auth_keygen')) { |
|
485 |
/** |
|
486 |
* @see ParagonIE_Sodium_Compat::crypto_auth_keygen() |
|
487 |
* @return string |
|
16 | 488 |
* @throws Exception |
9 | 489 |
*/ |
490 |
function sodium_crypto_auth_keygen() |
|
491 |
{ |
|
492 |
return ParagonIE_Sodium_Compat::crypto_auth_keygen(); |
|
493 |
} |
|
494 |
} |
|
495 |
if (!is_callable('sodium_crypto_auth_verify')) { |
|
496 |
/** |
|
497 |
* @see ParagonIE_Sodium_Compat::crypto_auth_verify() |
|
498 |
* @param string $mac |
|
499 |
* @param string $message |
|
500 |
* @param string $key |
|
501 |
* @return bool |
|
502 |
* @throws SodiumException |
|
503 |
* @throws TypeError |
|
504 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
505 |
function sodium_crypto_auth_verify( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
506 |
$mac, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
507 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
508 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
509 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
510 |
) { |
9 | 511 |
return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
512 |
} |
|
513 |
} |
|
514 |
if (!is_callable('sodium_crypto_box')) { |
|
515 |
/** |
|
516 |
* @see ParagonIE_Sodium_Compat::crypto_box() |
|
517 |
* @param string $message |
|
518 |
* @param string $nonce |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
519 |
* @param string $key_pair |
9 | 520 |
* @return string |
521 |
* @throws SodiumException |
|
522 |
* @throws TypeError |
|
523 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
524 |
function sodium_crypto_box( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
525 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
526 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
527 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
528 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
529 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
530 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
531 |
return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $key_pair); |
9 | 532 |
} |
533 |
} |
|
534 |
if (!is_callable('sodium_crypto_box_keypair')) { |
|
535 |
/** |
|
536 |
* @see ParagonIE_Sodium_Compat::crypto_box_keypair() |
|
537 |
* @return string |
|
538 |
* @throws SodiumException |
|
539 |
* @throws TypeError |
|
540 |
*/ |
|
541 |
function sodium_crypto_box_keypair() |
|
542 |
{ |
|
543 |
return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
|
544 |
} |
|
545 |
} |
|
546 |
if (!is_callable('sodium_crypto_box_keypair_from_secretkey_and_publickey')) { |
|
547 |
/** |
|
548 |
* @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
549 |
* @param string $secret_key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
550 |
* @param string $public_key |
9 | 551 |
* @return string |
552 |
* @throws SodiumException |
|
553 |
* @throws TypeError |
|
554 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
555 |
function sodium_crypto_box_keypair_from_secretkey_and_publickey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
556 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
557 |
$secret_key, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
558 |
$public_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
559 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
560 |
return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($secret_key, $public_key); |
9 | 561 |
} |
562 |
} |
|
563 |
if (!is_callable('sodium_crypto_box_open')) { |
|
564 |
/** |
|
565 |
* @see ParagonIE_Sodium_Compat::crypto_box_open() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
566 |
* @param string $ciphertext |
9 | 567 |
* @param string $nonce |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
568 |
* @param string $key_pair |
9 | 569 |
* @return string|bool |
570 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
571 |
function sodium_crypto_box_open( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
572 |
$ciphertext, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
573 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
574 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
575 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
576 |
) { |
9 | 577 |
try { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
578 |
return ParagonIE_Sodium_Compat::crypto_box_open($ciphertext, $nonce, $key_pair); |
9 | 579 |
} catch (Error $ex) { |
580 |
return false; |
|
581 |
} catch (Exception $ex) { |
|
582 |
return false; |
|
583 |
} |
|
584 |
} |
|
585 |
} |
|
586 |
if (!is_callable('sodium_crypto_box_publickey')) { |
|
587 |
/** |
|
588 |
* @see ParagonIE_Sodium_Compat::crypto_box_publickey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
589 |
* @param string $key_pair |
9 | 590 |
* @return string |
591 |
* @throws SodiumException |
|
592 |
* @throws TypeError |
|
593 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
594 |
function sodium_crypto_box_publickey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
595 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
596 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
597 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
598 |
return ParagonIE_Sodium_Compat::crypto_box_publickey($key_pair); |
9 | 599 |
} |
600 |
} |
|
601 |
if (!is_callable('sodium_crypto_box_publickey_from_secretkey')) { |
|
602 |
/** |
|
603 |
* @see ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
604 |
* @param string $secret_key |
9 | 605 |
* @return string |
606 |
* @throws SodiumException |
|
607 |
* @throws TypeError |
|
608 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
609 |
function sodium_crypto_box_publickey_from_secretkey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
610 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
611 |
$secret_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
612 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
613 |
return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($secret_key); |
9 | 614 |
} |
615 |
} |
|
616 |
if (!is_callable('sodium_crypto_box_seal')) { |
|
617 |
/** |
|
618 |
* @see ParagonIE_Sodium_Compat::crypto_box_seal() |
|
619 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
620 |
* @param string $public_key |
9 | 621 |
* @return string |
622 |
* @throws SodiumException |
|
623 |
* @throws TypeError |
|
624 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
625 |
function sodium_crypto_box_seal( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
626 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
627 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
628 |
$public_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
629 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
630 |
return ParagonIE_Sodium_Compat::crypto_box_seal($message, $public_key); |
9 | 631 |
} |
632 |
} |
|
633 |
if (!is_callable('sodium_crypto_box_seal_open')) { |
|
634 |
/** |
|
635 |
* @see ParagonIE_Sodium_Compat::crypto_box_seal_open() |
|
636 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
637 |
* @param string $key_pair |
9 | 638 |
* @return string|bool |
639 |
* @throws SodiumException |
|
640 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
641 |
function sodium_crypto_box_seal_open( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
642 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
643 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
644 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
645 |
) { |
9 | 646 |
try { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
647 |
return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $key_pair); |
9 | 648 |
} catch (SodiumException $ex) { |
649 |
if ($ex->getMessage() === 'Argument 2 must be CRYPTO_BOX_KEYPAIRBYTES long.') { |
|
650 |
throw $ex; |
|
651 |
} |
|
652 |
return false; |
|
653 |
} |
|
654 |
} |
|
655 |
} |
|
656 |
if (!is_callable('sodium_crypto_box_secretkey')) { |
|
657 |
/** |
|
658 |
* @see ParagonIE_Sodium_Compat::crypto_box_secretkey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
659 |
* @param string $key_pair |
9 | 660 |
* @return string |
661 |
* @throws SodiumException |
|
662 |
* @throws TypeError |
|
663 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
664 |
function sodium_crypto_box_secretkey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
665 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
666 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
667 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
668 |
return ParagonIE_Sodium_Compat::crypto_box_secretkey($key_pair); |
9 | 669 |
} |
670 |
} |
|
671 |
if (!is_callable('sodium_crypto_box_seed_keypair')) { |
|
672 |
/** |
|
673 |
* @see ParagonIE_Sodium_Compat::crypto_box_seed_keypair() |
|
674 |
* @param string $seed |
|
675 |
* @return string |
|
676 |
* @throws SodiumException |
|
677 |
* @throws TypeError |
|
678 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
679 |
function sodium_crypto_box_seed_keypair( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
680 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
681 |
$seed |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
682 |
) { |
9 | 683 |
return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); |
684 |
} |
|
685 |
} |
|
686 |
if (!is_callable('sodium_crypto_generichash')) { |
|
687 |
/** |
|
688 |
* @see ParagonIE_Sodium_Compat::crypto_generichash() |
|
689 |
* @param string $message |
|
690 |
* @param string|null $key |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
691 |
* @param int $length |
9 | 692 |
* @return string |
693 |
* @throws SodiumException |
|
694 |
* @throws TypeError |
|
695 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
696 |
function sodium_crypto_generichash( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
697 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
698 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
699 |
$key = null, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
700 |
$length = 32 |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
701 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
702 |
return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $length); |
9 | 703 |
} |
704 |
} |
|
705 |
if (!is_callable('sodium_crypto_generichash_final')) { |
|
706 |
/** |
|
707 |
* @see ParagonIE_Sodium_Compat::crypto_generichash_final() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
708 |
* @param string|null $state |
9 | 709 |
* @param int $outputLength |
710 |
* @return string |
|
711 |
* @throws SodiumException |
|
712 |
* @throws TypeError |
|
713 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
714 |
function sodium_crypto_generichash_final(&$state, $outputLength = 32) |
9 | 715 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
716 |
return ParagonIE_Sodium_Compat::crypto_generichash_final($state, $outputLength); |
9 | 717 |
} |
718 |
} |
|
719 |
if (!is_callable('sodium_crypto_generichash_init')) { |
|
720 |
/** |
|
721 |
* @see ParagonIE_Sodium_Compat::crypto_generichash_init() |
|
722 |
* @param string|null $key |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
723 |
* @param int $length |
9 | 724 |
* @return string |
725 |
* @throws SodiumException |
|
726 |
* @throws TypeError |
|
727 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
728 |
function sodium_crypto_generichash_init( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
729 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
730 |
$key = null, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
731 |
$length = 32 |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
732 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
733 |
return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $length); |
9 | 734 |
} |
735 |
} |
|
736 |
if (!is_callable('sodium_crypto_generichash_keygen')) { |
|
737 |
/** |
|
738 |
* @see ParagonIE_Sodium_Compat::crypto_generichash_keygen() |
|
739 |
* @return string |
|
16 | 740 |
* @throws Exception |
9 | 741 |
*/ |
742 |
function sodium_crypto_generichash_keygen() |
|
743 |
{ |
|
744 |
return ParagonIE_Sodium_Compat::crypto_generichash_keygen(); |
|
745 |
} |
|
746 |
} |
|
747 |
if (!is_callable('sodium_crypto_generichash_update')) { |
|
748 |
/** |
|
749 |
* @see ParagonIE_Sodium_Compat::crypto_generichash_update() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
750 |
* @param string|null $state |
9 | 751 |
* @param string $message |
752 |
* @return void |
|
753 |
* @throws SodiumException |
|
754 |
* @throws TypeError |
|
755 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
756 |
function sodium_crypto_generichash_update( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
757 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
758 |
&$state, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
759 |
$message = '' |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
760 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
761 |
ParagonIE_Sodium_Compat::crypto_generichash_update($state, $message); |
9 | 762 |
} |
763 |
} |
|
16 | 764 |
if (!is_callable('sodium_crypto_kdf_keygen')) { |
765 |
/** |
|
766 |
* @see ParagonIE_Sodium_Compat::crypto_kdf_keygen() |
|
767 |
* @return string |
|
768 |
* @throws Exception |
|
769 |
*/ |
|
770 |
function sodium_crypto_kdf_keygen() |
|
771 |
{ |
|
772 |
return ParagonIE_Sodium_Compat::crypto_kdf_keygen(); |
|
773 |
} |
|
774 |
} |
|
775 |
if (!is_callable('sodium_crypto_kdf_derive_from_key')) { |
|
776 |
/** |
|
777 |
* @see ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
778 |
* @param int $subkey_length |
16 | 779 |
* @param int $subkey_id |
780 |
* @param string $context |
|
781 |
* @param string $key |
|
782 |
* @return string |
|
783 |
* @throws Exception |
|
784 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
785 |
function sodium_crypto_kdf_derive_from_key( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
786 |
$subkey_length, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
787 |
$subkey_id, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
788 |
$context, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
789 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
790 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
791 |
) { |
16 | 792 |
return ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key( |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
793 |
$subkey_length, |
16 | 794 |
$subkey_id, |
795 |
$context, |
|
796 |
$key |
|
797 |
); |
|
798 |
} |
|
799 |
} |
|
9 | 800 |
if (!is_callable('sodium_crypto_kx')) { |
801 |
/** |
|
802 |
* @see ParagonIE_Sodium_Compat::crypto_kx() |
|
803 |
* @param string $my_secret |
|
804 |
* @param string $their_public |
|
805 |
* @param string $client_public |
|
806 |
* @param string $server_public |
|
807 |
* @return string |
|
808 |
* @throws SodiumException |
|
809 |
* @throws TypeError |
|
810 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
811 |
function sodium_crypto_kx( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
812 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
813 |
$my_secret, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
814 |
$their_public, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
815 |
$client_public, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
816 |
$server_public |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
817 |
) { |
9 | 818 |
return ParagonIE_Sodium_Compat::crypto_kx( |
819 |
$my_secret, |
|
820 |
$their_public, |
|
821 |
$client_public, |
|
822 |
$server_public |
|
823 |
); |
|
824 |
} |
|
825 |
} |
|
16 | 826 |
if (!is_callable('sodium_crypto_kx_seed_keypair')) { |
827 |
/** |
|
828 |
* @param string $seed |
|
829 |
* @return string |
|
830 |
* @throws Exception |
|
831 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
832 |
function sodium_crypto_kx_seed_keypair( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
833 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
834 |
$seed |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
835 |
) { |
16 | 836 |
return ParagonIE_Sodium_Compat::crypto_kx_seed_keypair($seed); |
837 |
} |
|
838 |
} |
|
839 |
if (!is_callable('sodium_crypto_kx_keypair')) { |
|
840 |
/** |
|
841 |
* @return string |
|
842 |
* @throws Exception |
|
843 |
*/ |
|
844 |
function sodium_crypto_kx_keypair() |
|
845 |
{ |
|
846 |
return ParagonIE_Sodium_Compat::crypto_kx_keypair(); |
|
847 |
} |
|
848 |
} |
|
849 |
if (!is_callable('sodium_crypto_kx_client_session_keys')) { |
|
850 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
851 |
* @param string $client_key_pair |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
852 |
* @param string $server_key |
16 | 853 |
* @return array{0: string, 1: string} |
854 |
* @throws SodiumException |
|
855 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
856 |
function sodium_crypto_kx_client_session_keys( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
857 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
858 |
$client_key_pair, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
859 |
$server_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
860 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
861 |
return ParagonIE_Sodium_Compat::crypto_kx_client_session_keys($client_key_pair, $server_key); |
16 | 862 |
} |
863 |
} |
|
864 |
if (!is_callable('sodium_crypto_kx_server_session_keys')) { |
|
865 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
866 |
* @param string $server_key_pair |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
867 |
* @param string $client_key |
16 | 868 |
* @return array{0: string, 1: string} |
869 |
* @throws SodiumException |
|
870 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
871 |
function sodium_crypto_kx_server_session_keys( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
872 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
873 |
$server_key_pair, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
874 |
$client_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
875 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
876 |
return ParagonIE_Sodium_Compat::crypto_kx_server_session_keys($server_key_pair, $client_key); |
16 | 877 |
} |
878 |
} |
|
879 |
if (!is_callable('sodium_crypto_kx_secretkey')) { |
|
880 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
881 |
* @param string $key_pair |
16 | 882 |
* @return string |
883 |
* @throws Exception |
|
884 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
885 |
function sodium_crypto_kx_secretkey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
886 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
887 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
888 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
889 |
return ParagonIE_Sodium_Compat::crypto_kx_secretkey($key_pair); |
16 | 890 |
} |
891 |
} |
|
892 |
if (!is_callable('sodium_crypto_kx_publickey')) { |
|
893 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
894 |
* @param string $key_pair |
16 | 895 |
* @return string |
896 |
* @throws Exception |
|
897 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
898 |
function sodium_crypto_kx_publickey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
899 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
900 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
901 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
902 |
return ParagonIE_Sodium_Compat::crypto_kx_publickey($key_pair); |
16 | 903 |
} |
904 |
} |
|
9 | 905 |
if (!is_callable('sodium_crypto_pwhash')) { |
906 |
/** |
|
907 |
* @see ParagonIE_Sodium_Compat::crypto_pwhash() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
908 |
* @param int $length |
9 | 909 |
* @param string $passwd |
910 |
* @param string $salt |
|
911 |
* @param int $opslimit |
|
912 |
* @param int $memlimit |
|
913 |
* @param int|null $algo |
|
914 |
* @return string |
|
915 |
* @throws SodiumException |
|
916 |
* @throws TypeError |
|
917 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
918 |
function sodium_crypto_pwhash( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
919 |
$length, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
920 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
921 |
$passwd, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
922 |
$salt, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
923 |
$opslimit, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
924 |
$memlimit, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
925 |
$algo = null |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
926 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
927 |
return ParagonIE_Sodium_Compat::crypto_pwhash($length, $passwd, $salt, $opslimit, $memlimit, $algo); |
9 | 928 |
} |
929 |
} |
|
930 |
if (!is_callable('sodium_crypto_pwhash_str')) { |
|
931 |
/** |
|
932 |
* @see ParagonIE_Sodium_Compat::crypto_pwhash_str() |
|
933 |
* @param string $passwd |
|
934 |
* @param int $opslimit |
|
935 |
* @param int $memlimit |
|
936 |
* @return string |
|
937 |
* @throws SodiumException |
|
938 |
* @throws TypeError |
|
939 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
940 |
function sodium_crypto_pwhash_str( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
941 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
942 |
$passwd, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
943 |
$opslimit, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
944 |
$memlimit |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
945 |
) { |
9 | 946 |
return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
947 |
} |
|
948 |
} |
|
16 | 949 |
if (!is_callable('sodium_crypto_pwhash_str_needs_rehash')) { |
950 |
/** |
|
951 |
* @see ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash() |
|
952 |
* @param string $hash |
|
953 |
* @param int $opslimit |
|
954 |
* @param int $memlimit |
|
955 |
* @return bool |
|
956 |
* |
|
957 |
* @throws SodiumException |
|
958 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
959 |
function sodium_crypto_pwhash_str_needs_rehash( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
960 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
961 |
$hash, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
962 |
$opslimit, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
963 |
$memlimit |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
964 |
) { |
16 | 965 |
return ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit); |
966 |
} |
|
967 |
} |
|
9 | 968 |
if (!is_callable('sodium_crypto_pwhash_str_verify')) { |
969 |
/** |
|
970 |
* @see ParagonIE_Sodium_Compat::crypto_pwhash_str_verify() |
|
971 |
* @param string $passwd |
|
972 |
* @param string $hash |
|
973 |
* @return bool |
|
974 |
* @throws SodiumException |
|
975 |
* @throws TypeError |
|
976 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
977 |
function sodium_crypto_pwhash_str_verify( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
978 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
979 |
$passwd, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
980 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
981 |
$hash |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
982 |
) { |
9 | 983 |
return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
984 |
} |
|
985 |
} |
|
986 |
if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256')) { |
|
987 |
/** |
|
988 |
* @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
989 |
* @param int $length |
9 | 990 |
* @param string $passwd |
991 |
* @param string $salt |
|
992 |
* @param int $opslimit |
|
993 |
* @param int $memlimit |
|
994 |
* @return string |
|
995 |
* @throws SodiumException |
|
996 |
* @throws TypeError |
|
997 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
998 |
function sodium_crypto_pwhash_scryptsalsa208sha256( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
999 |
$length, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1000 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1001 |
$passwd, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1002 |
$salt, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1003 |
$opslimit, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1004 |
$memlimit |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1005 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1006 |
return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1007 |
$length, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1008 |
$passwd, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1009 |
$salt, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1010 |
$opslimit, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1011 |
$memlimit |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1012 |
); |
9 | 1013 |
} |
1014 |
} |
|
1015 |
if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str')) { |
|
1016 |
/** |
|
1017 |
* @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str() |
|
1018 |
* @param string $passwd |
|
1019 |
* @param int $opslimit |
|
1020 |
* @param int $memlimit |
|
1021 |
* @return string |
|
1022 |
* @throws SodiumException |
|
1023 |
* @throws TypeError |
|
1024 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1025 |
function sodium_crypto_pwhash_scryptsalsa208sha256_str( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1026 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1027 |
$passwd, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1028 |
$opslimit, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1029 |
$memlimit |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1030 |
) { |
9 | 1031 |
return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
1032 |
} |
|
1033 |
} |
|
1034 |
if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str_verify')) { |
|
1035 |
/** |
|
1036 |
* @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify() |
|
1037 |
* @param string $passwd |
|
1038 |
* @param string $hash |
|
1039 |
* @return bool |
|
1040 |
* @throws SodiumException |
|
1041 |
* @throws TypeError |
|
1042 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1043 |
function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1044 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1045 |
$passwd, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1046 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1047 |
$hash |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1048 |
) { |
9 | 1049 |
return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
1050 |
} |
|
1051 |
} |
|
1052 |
if (!is_callable('sodium_crypto_scalarmult')) { |
|
1053 |
/** |
|
1054 |
* @see ParagonIE_Sodium_Compat::crypto_scalarmult() |
|
1055 |
* @param string $n |
|
1056 |
* @param string $p |
|
1057 |
* @return string |
|
1058 |
* @throws SodiumException |
|
1059 |
* @throws TypeError |
|
1060 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1061 |
function sodium_crypto_scalarmult( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1062 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1063 |
$n, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1064 |
$p |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1065 |
) { |
9 | 1066 |
return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
1067 |
} |
|
1068 |
} |
|
1069 |
if (!is_callable('sodium_crypto_scalarmult_base')) { |
|
1070 |
/** |
|
1071 |
* @see ParagonIE_Sodium_Compat::crypto_scalarmult_base() |
|
1072 |
* @param string $n |
|
1073 |
* @return string |
|
1074 |
* @throws SodiumException |
|
1075 |
* @throws TypeError |
|
1076 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1077 |
function sodium_crypto_scalarmult_base( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1078 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1079 |
$n |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1080 |
) { |
9 | 1081 |
return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
1082 |
} |
|
1083 |
} |
|
1084 |
if (!is_callable('sodium_crypto_secretbox')) { |
|
1085 |
/** |
|
1086 |
* @see ParagonIE_Sodium_Compat::crypto_secretbox() |
|
1087 |
* @param string $message |
|
1088 |
* @param string $nonce |
|
1089 |
* @param string $key |
|
1090 |
* @return string |
|
1091 |
* @throws SodiumException |
|
1092 |
* @throws TypeError |
|
1093 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1094 |
function sodium_crypto_secretbox( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1095 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1096 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1097 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1098 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1099 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1100 |
) { |
9 | 1101 |
return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
1102 |
} |
|
1103 |
} |
|
1104 |
if (!is_callable('sodium_crypto_secretbox_keygen')) { |
|
1105 |
/** |
|
1106 |
* @see ParagonIE_Sodium_Compat::crypto_secretbox_keygen() |
|
1107 |
* @return string |
|
16 | 1108 |
* @throws Exception |
9 | 1109 |
*/ |
1110 |
function sodium_crypto_secretbox_keygen() |
|
1111 |
{ |
|
1112 |
return ParagonIE_Sodium_Compat::crypto_secretbox_keygen(); |
|
1113 |
} |
|
1114 |
} |
|
1115 |
if (!is_callable('sodium_crypto_secretbox_open')) { |
|
1116 |
/** |
|
1117 |
* @see ParagonIE_Sodium_Compat::crypto_secretbox_open() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1118 |
* @param string $ciphertext |
9 | 1119 |
* @param string $nonce |
1120 |
* @param string $key |
|
1121 |
* @return string|bool |
|
1122 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1123 |
function sodium_crypto_secretbox_open( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1124 |
$ciphertext, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1125 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1126 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1127 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1128 |
) { |
9 | 1129 |
try { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1130 |
return ParagonIE_Sodium_Compat::crypto_secretbox_open($ciphertext, $nonce, $key); |
9 | 1131 |
} catch (Error $ex) { |
1132 |
return false; |
|
1133 |
} catch (Exception $ex) { |
|
1134 |
return false; |
|
1135 |
} |
|
1136 |
} |
|
1137 |
} |
|
16 | 1138 |
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_push')) { |
1139 |
/** |
|
1140 |
* @param string $key |
|
1141 |
* @return array<int, string> |
|
1142 |
* @throws SodiumException |
|
1143 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1144 |
function sodium_crypto_secretstream_xchacha20poly1305_init_push( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1145 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1146 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1147 |
) { |
16 | 1148 |
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_push($key); |
1149 |
} |
|
1150 |
} |
|
1151 |
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_push')) { |
|
1152 |
/** |
|
1153 |
* @param string $state |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1154 |
* @param string $message |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1155 |
* @param string $additional_data |
16 | 1156 |
* @param int $tag |
1157 |
* @return string |
|
1158 |
* @throws SodiumException |
|
1159 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1160 |
function sodium_crypto_secretstream_xchacha20poly1305_push( |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1161 |
#[\SensitiveParameter] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1162 |
&$state, |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1163 |
#[\SensitiveParameter] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1164 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1165 |
$additional_data = '', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1166 |
$tag = 0 |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1167 |
) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1168 |
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_push( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1169 |
$state, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1170 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1171 |
$additional_data, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1172 |
$tag |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1173 |
); |
16 | 1174 |
} |
1175 |
} |
|
1176 |
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_pull')) { |
|
1177 |
/** |
|
1178 |
* @param string $header |
|
1179 |
* @param string $key |
|
1180 |
* @return string |
|
1181 |
* @throws Exception |
|
1182 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1183 |
function sodium_crypto_secretstream_xchacha20poly1305_init_pull( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1184 |
$header, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1185 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1186 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1187 |
) { |
16 | 1188 |
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull($header, $key); |
1189 |
} |
|
1190 |
} |
|
1191 |
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_pull')) { |
|
1192 |
/** |
|
1193 |
* @param string $state |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1194 |
* @param string $ciphertext |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1195 |
* @param string $additional_data |
16 | 1196 |
* @return bool|array{0: string, 1: int} |
1197 |
* @throws SodiumException |
|
1198 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1199 |
function sodium_crypto_secretstream_xchacha20poly1305_pull( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1200 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1201 |
&$state, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1202 |
$ciphertext, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1203 |
$additional_data = '' |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1204 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1205 |
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1206 |
$state, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1207 |
$ciphertext, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1208 |
$additional_data |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1209 |
); |
16 | 1210 |
} |
1211 |
} |
|
1212 |
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_rekey')) { |
|
1213 |
/** |
|
1214 |
* @param string $state |
|
1215 |
* @return void |
|
1216 |
* @throws SodiumException |
|
1217 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1218 |
function sodium_crypto_secretstream_xchacha20poly1305_rekey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1219 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1220 |
&$state |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1221 |
) { |
16 | 1222 |
ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey($state); |
1223 |
} |
|
1224 |
} |
|
1225 |
if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_keygen')) { |
|
1226 |
/** |
|
1227 |
* @return string |
|
1228 |
* @throws Exception |
|
1229 |
*/ |
|
1230 |
function sodium_crypto_secretstream_xchacha20poly1305_keygen() |
|
1231 |
{ |
|
1232 |
return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_keygen(); |
|
1233 |
} |
|
1234 |
} |
|
9 | 1235 |
if (!is_callable('sodium_crypto_shorthash')) { |
1236 |
/** |
|
1237 |
* @see ParagonIE_Sodium_Compat::crypto_shorthash() |
|
1238 |
* @param string $message |
|
1239 |
* @param string $key |
|
1240 |
* @return string |
|
1241 |
* @throws SodiumException |
|
1242 |
* @throws TypeError |
|
1243 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1244 |
function sodium_crypto_shorthash( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1245 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1246 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1247 |
$key = '' |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1248 |
) { |
9 | 1249 |
return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
1250 |
} |
|
1251 |
} |
|
1252 |
if (!is_callable('sodium_crypto_shorthash_keygen')) { |
|
1253 |
/** |
|
1254 |
* @see ParagonIE_Sodium_Compat::crypto_shorthash_keygen() |
|
1255 |
* @return string |
|
16 | 1256 |
* @throws Exception |
9 | 1257 |
*/ |
1258 |
function sodium_crypto_shorthash_keygen() |
|
1259 |
{ |
|
1260 |
return ParagonIE_Sodium_Compat::crypto_shorthash_keygen(); |
|
1261 |
} |
|
1262 |
} |
|
1263 |
if (!is_callable('sodium_crypto_sign')) { |
|
1264 |
/** |
|
1265 |
* @see ParagonIE_Sodium_Compat::crypto_sign() |
|
1266 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1267 |
* @param string $secret_key |
9 | 1268 |
* @return string |
1269 |
* @throws SodiumException |
|
1270 |
* @throws TypeError |
|
1271 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1272 |
function sodium_crypto_sign( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1273 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1274 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1275 |
$secret_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1276 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1277 |
return ParagonIE_Sodium_Compat::crypto_sign($message, $secret_key); |
9 | 1278 |
} |
1279 |
} |
|
1280 |
if (!is_callable('sodium_crypto_sign_detached')) { |
|
1281 |
/** |
|
1282 |
* @see ParagonIE_Sodium_Compat::crypto_sign_detached() |
|
1283 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1284 |
* @param string $secret_key |
9 | 1285 |
* @return string |
1286 |
* @throws SodiumException |
|
1287 |
* @throws TypeError |
|
1288 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1289 |
function sodium_crypto_sign_detached( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1290 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1291 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1292 |
$secret_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1293 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1294 |
return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $secret_key); |
9 | 1295 |
} |
1296 |
} |
|
16 | 1297 |
if (!is_callable('sodium_crypto_sign_keypair_from_secretkey_and_publickey')) { |
1298 |
/** |
|
1299 |
* @see ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1300 |
* @param string $secret_key |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1301 |
* @param string $public_key |
16 | 1302 |
* @return string |
1303 |
* @throws SodiumException |
|
1304 |
* @throws TypeError |
|
1305 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1306 |
function sodium_crypto_sign_keypair_from_secretkey_and_publickey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1307 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1308 |
$secret_key, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1309 |
$public_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1310 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1311 |
return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey($secret_key, $public_key); |
16 | 1312 |
} |
1313 |
} |
|
9 | 1314 |
if (!is_callable('sodium_crypto_sign_keypair')) { |
1315 |
/** |
|
1316 |
* @see ParagonIE_Sodium_Compat::crypto_sign_keypair() |
|
1317 |
* @return string |
|
1318 |
* @throws SodiumException |
|
1319 |
* @throws TypeError |
|
1320 |
*/ |
|
1321 |
function sodium_crypto_sign_keypair() |
|
1322 |
{ |
|
1323 |
return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
|
1324 |
} |
|
1325 |
} |
|
1326 |
if (!is_callable('sodium_crypto_sign_open')) { |
|
1327 |
/** |
|
1328 |
* @see ParagonIE_Sodium_Compat::crypto_sign_open() |
|
1329 |
* @param string $signedMessage |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1330 |
* @param string $public_key |
9 | 1331 |
* @return string|bool |
1332 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1333 |
function sodium_crypto_sign_open($signedMessage, $public_key) |
9 | 1334 |
{ |
1335 |
try { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1336 |
return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $public_key); |
9 | 1337 |
} catch (Error $ex) { |
1338 |
return false; |
|
1339 |
} catch (Exception $ex) { |
|
1340 |
return false; |
|
1341 |
} |
|
1342 |
} |
|
1343 |
} |
|
1344 |
if (!is_callable('sodium_crypto_sign_publickey')) { |
|
1345 |
/** |
|
1346 |
* @see ParagonIE_Sodium_Compat::crypto_sign_publickey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1347 |
* @param string $key_pair |
9 | 1348 |
* @return string |
1349 |
* @throws SodiumException |
|
1350 |
* @throws TypeError |
|
1351 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1352 |
function sodium_crypto_sign_publickey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1353 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1354 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1355 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1356 |
return ParagonIE_Sodium_Compat::crypto_sign_publickey($key_pair); |
9 | 1357 |
} |
1358 |
} |
|
1359 |
if (!is_callable('sodium_crypto_sign_publickey_from_secretkey')) { |
|
1360 |
/** |
|
1361 |
* @see ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1362 |
* @param string $secret_key |
9 | 1363 |
* @return string |
1364 |
* @throws SodiumException |
|
1365 |
* @throws TypeError |
|
1366 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1367 |
function sodium_crypto_sign_publickey_from_secretkey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1368 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1369 |
$secret_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1370 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1371 |
return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($secret_key); |
9 | 1372 |
} |
1373 |
} |
|
1374 |
if (!is_callable('sodium_crypto_sign_secretkey')) { |
|
1375 |
/** |
|
1376 |
* @see ParagonIE_Sodium_Compat::crypto_sign_secretkey() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1377 |
* @param string $key_pair |
9 | 1378 |
* @return string |
1379 |
* @throws SodiumException |
|
1380 |
* @throws TypeError |
|
1381 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1382 |
function sodium_crypto_sign_secretkey( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1383 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1384 |
$key_pair |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1385 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1386 |
return ParagonIE_Sodium_Compat::crypto_sign_secretkey($key_pair); |
9 | 1387 |
} |
1388 |
} |
|
1389 |
if (!is_callable('sodium_crypto_sign_seed_keypair')) { |
|
1390 |
/** |
|
1391 |
* @see ParagonIE_Sodium_Compat::crypto_sign_seed_keypair() |
|
1392 |
* @param string $seed |
|
1393 |
* @return string |
|
1394 |
* @throws SodiumException |
|
1395 |
* @throws TypeError |
|
1396 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1397 |
function sodium_crypto_sign_seed_keypair( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1398 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1399 |
$seed |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1400 |
) { |
9 | 1401 |
return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
1402 |
} |
|
1403 |
} |
|
1404 |
if (!is_callable('sodium_crypto_sign_verify_detached')) { |
|
1405 |
/** |
|
1406 |
* @see ParagonIE_Sodium_Compat::crypto_sign_verify_detached() |
|
1407 |
* @param string $signature |
|
1408 |
* @param string $message |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1409 |
* @param string $public_key |
9 | 1410 |
* @return bool |
1411 |
* @throws SodiumException |
|
1412 |
* @throws TypeError |
|
1413 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1414 |
function sodium_crypto_sign_verify_detached($signature, $message, $public_key) |
9 | 1415 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1416 |
return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $public_key); |
9 | 1417 |
} |
1418 |
} |
|
1419 |
if (!is_callable('sodium_crypto_sign_ed25519_pk_to_curve25519')) { |
|
1420 |
/** |
|
1421 |
* @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1422 |
* @param string $public_key |
9 | 1423 |
* @return string |
1424 |
* @throws SodiumException |
|
1425 |
* @throws TypeError |
|
1426 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1427 |
function sodium_crypto_sign_ed25519_pk_to_curve25519($public_key) |
9 | 1428 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1429 |
return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($public_key); |
9 | 1430 |
} |
1431 |
} |
|
1432 |
if (!is_callable('sodium_crypto_sign_ed25519_sk_to_curve25519')) { |
|
1433 |
/** |
|
1434 |
* @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1435 |
* @param string $secret_key |
9 | 1436 |
* @return string |
1437 |
* @throws SodiumException |
|
1438 |
* @throws TypeError |
|
1439 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1440 |
function sodium_crypto_sign_ed25519_sk_to_curve25519( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1441 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1442 |
$secret_key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1443 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1444 |
return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($secret_key); |
9 | 1445 |
} |
1446 |
} |
|
1447 |
if (!is_callable('sodium_crypto_stream')) { |
|
1448 |
/** |
|
1449 |
* @see ParagonIE_Sodium_Compat::crypto_stream() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1450 |
* @param int $length |
9 | 1451 |
* @param string $nonce |
1452 |
* @param string $key |
|
1453 |
* @return string |
|
1454 |
* @throws SodiumException |
|
1455 |
* @throws TypeError |
|
1456 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1457 |
function sodium_crypto_stream( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1458 |
$length, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1459 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1460 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1461 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1462 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1463 |
return ParagonIE_Sodium_Compat::crypto_stream($length, $nonce, $key); |
9 | 1464 |
} |
1465 |
} |
|
1466 |
if (!is_callable('sodium_crypto_stream_keygen')) { |
|
1467 |
/** |
|
1468 |
* @see ParagonIE_Sodium_Compat::crypto_stream_keygen() |
|
1469 |
* @return string |
|
16 | 1470 |
* @throws Exception |
9 | 1471 |
*/ |
1472 |
function sodium_crypto_stream_keygen() |
|
1473 |
{ |
|
1474 |
return ParagonIE_Sodium_Compat::crypto_stream_keygen(); |
|
1475 |
} |
|
1476 |
} |
|
1477 |
if (!is_callable('sodium_crypto_stream_xor')) { |
|
1478 |
/** |
|
1479 |
* @see ParagonIE_Sodium_Compat::crypto_stream_xor() |
|
1480 |
* @param string $message |
|
1481 |
* @param string $nonce |
|
1482 |
* @param string $key |
|
1483 |
* @return string |
|
1484 |
* @throws SodiumException |
|
1485 |
* @throws TypeError |
|
1486 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1487 |
function sodium_crypto_stream_xor( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1488 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1489 |
$message, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1490 |
$nonce, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1491 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1492 |
$key |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1493 |
) { |
9 | 1494 |
return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
1495 |
} |
|
1496 |
} |
|
18 | 1497 |
require_once dirname(__FILE__) . '/stream-xchacha20.php'; |
9 | 1498 |
if (!is_callable('sodium_hex2bin')) { |
1499 |
/** |
|
1500 |
* @see ParagonIE_Sodium_Compat::hex2bin() |
|
1501 |
* @param string $string |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1502 |
* @param string $ignore |
9 | 1503 |
* @return string |
1504 |
* @throws SodiumException |
|
1505 |
* @throws TypeError |
|
1506 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1507 |
function sodium_hex2bin( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1508 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1509 |
$string, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1510 |
$ignore = '' |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1511 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1512 |
return ParagonIE_Sodium_Compat::hex2bin($string, $ignore); |
9 | 1513 |
} |
1514 |
} |
|
1515 |
if (!is_callable('sodium_increment')) { |
|
1516 |
/** |
|
1517 |
* @see ParagonIE_Sodium_Compat::increment() |
|
1518 |
* @param string $string |
|
1519 |
* @return void |
|
1520 |
* @throws SodiumException |
|
1521 |
* @throws TypeError |
|
1522 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1523 |
function sodium_increment( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1524 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1525 |
&$string |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1526 |
) { |
9 | 1527 |
ParagonIE_Sodium_Compat::increment($string); |
1528 |
} |
|
1529 |
} |
|
1530 |
if (!is_callable('sodium_library_version_major')) { |
|
1531 |
/** |
|
1532 |
* @see ParagonIE_Sodium_Compat::library_version_major() |
|
1533 |
* @return int |
|
1534 |
*/ |
|
1535 |
function sodium_library_version_major() |
|
1536 |
{ |
|
1537 |
return ParagonIE_Sodium_Compat::library_version_major(); |
|
1538 |
} |
|
1539 |
} |
|
1540 |
if (!is_callable('sodium_library_version_minor')) { |
|
1541 |
/** |
|
1542 |
* @see ParagonIE_Sodium_Compat::library_version_minor() |
|
1543 |
* @return int |
|
1544 |
*/ |
|
1545 |
function sodium_library_version_minor() |
|
1546 |
{ |
|
1547 |
return ParagonIE_Sodium_Compat::library_version_minor(); |
|
1548 |
} |
|
1549 |
} |
|
1550 |
if (!is_callable('sodium_version_string')) { |
|
1551 |
/** |
|
1552 |
* @see ParagonIE_Sodium_Compat::version_string() |
|
1553 |
* @return string |
|
1554 |
*/ |
|
1555 |
function sodium_version_string() |
|
1556 |
{ |
|
1557 |
return ParagonIE_Sodium_Compat::version_string(); |
|
1558 |
} |
|
1559 |
} |
|
1560 |
if (!is_callable('sodium_memcmp')) { |
|
1561 |
/** |
|
1562 |
* @see ParagonIE_Sodium_Compat::memcmp() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1563 |
* @param string $string1 |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1564 |
* @param string $string2 |
9 | 1565 |
* @return int |
1566 |
* @throws SodiumException |
|
1567 |
* @throws TypeError |
|
1568 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1569 |
function sodium_memcmp( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1570 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1571 |
$string1, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1572 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1573 |
$string2 |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1574 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1575 |
return ParagonIE_Sodium_Compat::memcmp($string1, $string2); |
9 | 1576 |
} |
1577 |
} |
|
1578 |
if (!is_callable('sodium_memzero')) { |
|
1579 |
/** |
|
1580 |
* @see ParagonIE_Sodium_Compat::memzero() |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1581 |
* @param string $string |
9 | 1582 |
* @return void |
1583 |
* @throws SodiumException |
|
1584 |
* @throws TypeError |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1585 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1586 |
* @psalm-suppress ReferenceConstraintViolation |
9 | 1587 |
*/ |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1588 |
function sodium_memzero( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1589 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1590 |
&$string |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1591 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1592 |
ParagonIE_Sodium_Compat::memzero($string); |
9 | 1593 |
} |
1594 |
} |
|
16 | 1595 |
if (!is_callable('sodium_pad')) { |
1596 |
/** |
|
1597 |
* @see ParagonIE_Sodium_Compat::pad() |
|
1598 |
* @param string $unpadded |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1599 |
* @param int $block_size |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1600 |
* @return string |
16 | 1601 |
* @throws SodiumException |
1602 |
* @throws TypeError |
|
1603 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1604 |
function sodium_pad( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1605 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1606 |
$unpadded, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1607 |
$block_size |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1608 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1609 |
return ParagonIE_Sodium_Compat::pad($unpadded, $block_size, true); |
16 | 1610 |
} |
1611 |
} |
|
1612 |
if (!is_callable('sodium_unpad')) { |
|
1613 |
/** |
|
1614 |
* @see ParagonIE_Sodium_Compat::pad() |
|
1615 |
* @param string $padded |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1616 |
* @param int $block_size |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1617 |
* @return string |
16 | 1618 |
* @throws SodiumException |
1619 |
* @throws TypeError |
|
1620 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1621 |
function sodium_unpad( |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1622 |
#[\SensitiveParameter] |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1623 |
$padded, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1624 |
$block_size |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1625 |
) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
1626 |
return ParagonIE_Sodium_Compat::unpad($padded, $block_size, true); |
16 | 1627 |
} |
1628 |
} |
|
9 | 1629 |
if (!is_callable('sodium_randombytes_buf')) { |
1630 |
/** |
|
1631 |
* @see ParagonIE_Sodium_Compat::randombytes_buf() |
|
1632 |
* @param int $amount |
|
1633 |
* @return string |
|
1634 |
* @throws Exception |
|
1635 |
*/ |
|
1636 |
function sodium_randombytes_buf($amount) |
|
1637 |
{ |
|
1638 |
return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
1639 |
} |
|
1640 |
} |
|
1641 |
||
1642 |
if (!is_callable('sodium_randombytes_uniform')) { |
|
1643 |
/** |
|
1644 |
* @see ParagonIE_Sodium_Compat::randombytes_uniform() |
|
1645 |
* @param int $upperLimit |
|
1646 |
* @return int |
|
1647 |
* @throws Exception |
|
1648 |
*/ |
|
1649 |
function sodium_randombytes_uniform($upperLimit) |
|
1650 |
{ |
|
1651 |
return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
1652 |
} |
|
1653 |
} |
|
1654 |
||
1655 |
if (!is_callable('sodium_randombytes_random16')) { |
|
1656 |
/** |
|
1657 |
* @see ParagonIE_Sodium_Compat::randombytes_random16() |
|
1658 |
* @return int |
|
16 | 1659 |
* @throws Exception |
9 | 1660 |
*/ |
1661 |
function sodium_randombytes_random16() |
|
1662 |
{ |
|
1663 |
return ParagonIE_Sodium_Compat::randombytes_random16(); |
|
1664 |
} |
|
1665 |
} |