@@ -208,8 +208,7 @@ |
||
208 | 208 | * @throws Exception |
209 | 209 | * @return string |
210 | 210 | */ |
211 | - function random_bytes($length) |
|
212 | - { |
|
211 | + function random_bytes($length) { |
|
213 | 212 | unset($length); // Suppress "variable not used" warnings. |
214 | 213 | throw new Exception( |
215 | 214 | 'There is no suitable CSPRNG installed on your system' |
@@ -28,21 +28,18 @@ |
||
28 | 28 | |
29 | 29 | if (!class_exists('Error', false)) { |
30 | 30 | // We can't really avoid making this extend Exception in PHP 5. |
31 | - class Error extends Exception |
|
32 | - { |
|
31 | + class Error extends Exception { |
|
33 | 32 | |
34 | 33 | } |
35 | 34 | } |
36 | 35 | |
37 | 36 | if (!class_exists('TypeError', false)) { |
38 | 37 | if (is_subclass_of('Error', 'Exception')) { |
39 | - class TypeError extends Error |
|
40 | - { |
|
38 | + class TypeError extends Error { |
|
41 | 39 | |
42 | 40 | } |
43 | 41 | } else { |
44 | - class TypeError extends Exception |
|
45 | - { |
|
42 | + class TypeError extends Exception { |
|
46 | 43 | |
47 | 44 | } |
48 | 45 | } |
@@ -44,8 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return int |
46 | 46 | */ |
47 | - function RandomCompat_strlen($binary_string) |
|
48 | - { |
|
47 | + function RandomCompat_strlen($binary_string) { |
|
49 | 48 | if (!is_string($binary_string)) { |
50 | 49 | throw new TypeError( |
51 | 50 | 'RandomCompat_strlen() expects a string' |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | * |
68 | 67 | * @return int |
69 | 68 | */ |
70 | - function RandomCompat_strlen($binary_string) |
|
71 | - { |
|
69 | + function RandomCompat_strlen($binary_string) { |
|
72 | 70 | if (!is_string($binary_string)) { |
73 | 71 | throw new TypeError( |
74 | 72 | 'RandomCompat_strlen() expects a string' |
@@ -100,8 +98,7 @@ discard block |
||
100 | 98 | * |
101 | 99 | * @return string |
102 | 100 | */ |
103 | - function RandomCompat_substr($binary_string, $start, $length = null) |
|
104 | - { |
|
101 | + function RandomCompat_substr($binary_string, $start, $length = null) { |
|
105 | 102 | if (!is_string($binary_string)) { |
106 | 103 | throw new TypeError( |
107 | 104 | 'RandomCompat_substr(): First argument should be a string' |
@@ -158,8 +155,7 @@ discard block |
||
158 | 155 | * |
159 | 156 | * @return string |
160 | 157 | */ |
161 | - function RandomCompat_substr($binary_string, $start, $length = null) |
|
162 | - { |
|
158 | + function RandomCompat_substr($binary_string, $start, $length = null) { |
|
163 | 159 | if (!is_string($binary_string)) { |
164 | 160 | throw new TypeError( |
165 | 161 | 'RandomCompat_substr(): First argument should be a string' |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @throws \SodiumException |
21 | 21 | * @throws \TypeError |
22 | 22 | */ |
23 | - function bin2hex($string) |
|
24 | - { |
|
23 | + function bin2hex($string) { |
|
25 | 24 | return ParagonIE_Sodium_Compat::bin2hex($string); |
26 | 25 | } |
27 | 26 | } |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | * @throws \SodiumException |
35 | 34 | * @throws \TypeError |
36 | 35 | */ |
37 | - function compare($a, $b) |
|
38 | - { |
|
36 | + function compare($a, $b) { |
|
39 | 37 | return ParagonIE_Sodium_Compat::compare($a, $b); |
40 | 38 | } |
41 | 39 | } |
@@ -48,8 +46,7 @@ discard block |
||
48 | 46 | * @param string $key |
49 | 47 | * @return string|bool |
50 | 48 | */ |
51 | - function crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) |
|
52 | - { |
|
49 | + function crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) { |
|
53 | 50 | try { |
54 | 51 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key); |
55 | 52 | } catch (\TypeError $ex) { |
@@ -70,8 +67,7 @@ discard block |
||
70 | 67 | * @throws \SodiumException |
71 | 68 | * @throws \TypeError |
72 | 69 | */ |
73 | - function crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) |
|
74 | - { |
|
70 | + function crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) { |
|
75 | 71 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key); |
76 | 72 | } |
77 | 73 | } |
@@ -80,8 +76,7 @@ discard block |
||
80 | 76 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available() |
81 | 77 | * @return bool |
82 | 78 | */ |
83 | - function crypto_aead_aes256gcm_is_available() |
|
84 | - { |
|
79 | + function crypto_aead_aes256gcm_is_available() { |
|
85 | 80 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available(); |
86 | 81 | } |
87 | 82 | } |
@@ -94,8 +89,7 @@ discard block |
||
94 | 89 | * @param string $key |
95 | 90 | * @return string|bool |
96 | 91 | */ |
97 | - function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
98 | - { |
|
92 | + function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) { |
|
99 | 93 | try { |
100 | 94 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
101 | 95 | } catch (\TypeError $ex) { |
@@ -116,8 +110,7 @@ discard block |
||
116 | 110 | * @throws \SodiumException |
117 | 111 | * @throws \TypeError |
118 | 112 | */ |
119 | - function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
120 | - { |
|
113 | + function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) { |
|
121 | 114 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
122 | 115 | } |
123 | 116 | } |
@@ -130,8 +123,7 @@ discard block |
||
130 | 123 | * @param string $key |
131 | 124 | * @return string|bool |
132 | 125 | */ |
133 | - function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
134 | - { |
|
126 | + function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) { |
|
135 | 127 | try { |
136 | 128 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
137 | 129 | } catch (\TypeError $ex) { |
@@ -152,8 +144,7 @@ discard block |
||
152 | 144 | * @throws \SodiumException |
153 | 145 | * @throws \TypeError |
154 | 146 | */ |
155 | - function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
156 | - { |
|
147 | + function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) { |
|
157 | 148 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
158 | 149 | } |
159 | 150 | } |
@@ -166,8 +157,7 @@ discard block |
||
166 | 157 | * @throws \SodiumException |
167 | 158 | * @throws \TypeError |
168 | 159 | */ |
169 | - function crypto_auth($message, $key) |
|
170 | - { |
|
160 | + function crypto_auth($message, $key) { |
|
171 | 161 | return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
172 | 162 | } |
173 | 163 | } |
@@ -181,8 +171,7 @@ discard block |
||
181 | 171 | * @throws \SodiumException |
182 | 172 | * @throws \TypeError |
183 | 173 | */ |
184 | - function crypto_auth_verify($mac, $message, $key) |
|
185 | - { |
|
174 | + function crypto_auth_verify($mac, $message, $key) { |
|
186 | 175 | return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
187 | 176 | } |
188 | 177 | } |
@@ -196,8 +185,7 @@ discard block |
||
196 | 185 | * @throws \SodiumException |
197 | 186 | * @throws \TypeError |
198 | 187 | */ |
199 | - function crypto_box($message, $nonce, $kp) |
|
200 | - { |
|
188 | + function crypto_box($message, $nonce, $kp) { |
|
201 | 189 | return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
202 | 190 | } |
203 | 191 | } |
@@ -208,8 +196,7 @@ discard block |
||
208 | 196 | * @throws \SodiumException |
209 | 197 | * @throws \TypeError |
210 | 198 | */ |
211 | - function crypto_box_keypair() |
|
212 | - { |
|
199 | + function crypto_box_keypair() { |
|
213 | 200 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
214 | 201 | } |
215 | 202 | } |
@@ -222,8 +209,7 @@ discard block |
||
222 | 209 | * @throws \SodiumException |
223 | 210 | * @throws \TypeError |
224 | 211 | */ |
225 | - function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
226 | - { |
|
212 | + function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) { |
|
227 | 213 | return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
228 | 214 | } |
229 | 215 | } |
@@ -235,8 +221,7 @@ discard block |
||
235 | 221 | * @param string $kp |
236 | 222 | * @return string|bool |
237 | 223 | */ |
238 | - function crypto_box_open($message, $nonce, $kp) |
|
239 | - { |
|
224 | + function crypto_box_open($message, $nonce, $kp) { |
|
240 | 225 | try { |
241 | 226 | return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
242 | 227 | } catch (\TypeError $ex) { |
@@ -254,8 +239,7 @@ discard block |
||
254 | 239 | * @throws \SodiumException |
255 | 240 | * @throws \TypeError |
256 | 241 | */ |
257 | - function crypto_box_publickey($keypair) |
|
258 | - { |
|
242 | + function crypto_box_publickey($keypair) { |
|
259 | 243 | return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
260 | 244 | } |
261 | 245 | } |
@@ -267,8 +251,7 @@ discard block |
||
267 | 251 | * @throws \SodiumException |
268 | 252 | * @throws \TypeError |
269 | 253 | */ |
270 | - function crypto_box_publickey_from_secretkey($sk) |
|
271 | - { |
|
254 | + function crypto_box_publickey_from_secretkey($sk) { |
|
272 | 255 | return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
273 | 256 | } |
274 | 257 | } |
@@ -281,8 +264,7 @@ discard block |
||
281 | 264 | * @throws \SodiumException |
282 | 265 | * @throws \TypeError |
283 | 266 | */ |
284 | - function crypto_box_seal($message, $publicKey) |
|
285 | - { |
|
267 | + function crypto_box_seal($message, $publicKey) { |
|
286 | 268 | return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
287 | 269 | } |
288 | 270 | } |
@@ -293,8 +275,7 @@ discard block |
||
293 | 275 | * @param string $kp |
294 | 276 | * @return string|bool |
295 | 277 | */ |
296 | - function crypto_box_seal_open($message, $kp) |
|
297 | - { |
|
278 | + function crypto_box_seal_open($message, $kp) { |
|
298 | 279 | try { |
299 | 280 | return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
300 | 281 | } catch (\TypeError $ex) { |
@@ -312,8 +293,7 @@ discard block |
||
312 | 293 | * @throws \SodiumException |
313 | 294 | * @throws \TypeError |
314 | 295 | */ |
315 | - function crypto_box_secretkey($keypair) |
|
316 | - { |
|
296 | + function crypto_box_secretkey($keypair) { |
|
317 | 297 | return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
318 | 298 | } |
319 | 299 | } |
@@ -327,8 +307,7 @@ discard block |
||
327 | 307 | * @throws \SodiumException |
328 | 308 | * @throws \TypeError |
329 | 309 | */ |
330 | - function crypto_generichash($message, $key = null, $outLen = 32) |
|
331 | - { |
|
310 | + function crypto_generichash($message, $key = null, $outLen = 32) { |
|
332 | 311 | return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
333 | 312 | } |
334 | 313 | } |
@@ -341,8 +320,7 @@ discard block |
||
341 | 320 | * @throws \SodiumException |
342 | 321 | * @throws \TypeError |
343 | 322 | */ |
344 | - function crypto_generichash_final(&$ctx, $outputLength = 32) |
|
345 | - { |
|
323 | + function crypto_generichash_final(&$ctx, $outputLength = 32) { |
|
346 | 324 | return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
347 | 325 | } |
348 | 326 | } |
@@ -355,8 +333,7 @@ discard block |
||
355 | 333 | * @throws \SodiumException |
356 | 334 | * @throws \TypeError |
357 | 335 | */ |
358 | - function crypto_generichash_init($key = null, $outLen = 32) |
|
359 | - { |
|
336 | + function crypto_generichash_init($key = null, $outLen = 32) { |
|
360 | 337 | return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
361 | 338 | } |
362 | 339 | } |
@@ -369,8 +346,7 @@ discard block |
||
369 | 346 | * @throws \SodiumException |
370 | 347 | * @throws \TypeError |
371 | 348 | */ |
372 | - function crypto_generichash_update(&$ctx, $message = '') |
|
373 | - { |
|
349 | + function crypto_generichash_update(&$ctx, $message = '') { |
|
374 | 350 | ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
375 | 351 | } |
376 | 352 | } |
@@ -385,8 +361,7 @@ discard block |
||
385 | 361 | * @throws \SodiumException |
386 | 362 | * @throws \TypeError |
387 | 363 | */ |
388 | - function crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
389 | - { |
|
364 | + function crypto_kx($my_secret, $their_public, $client_public, $server_public) { |
|
390 | 365 | return ParagonIE_Sodium_Compat::crypto_kx( |
391 | 366 | $my_secret, |
392 | 367 | $their_public, |
@@ -408,8 +383,7 @@ discard block |
||
408 | 383 | * @throws \SodiumException |
409 | 384 | * @throws \TypeError |
410 | 385 | */ |
411 | - function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
412 | - { |
|
386 | + function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
413 | 387 | return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
414 | 388 | } |
415 | 389 | } |
@@ -423,8 +397,7 @@ discard block |
||
423 | 397 | * @throws \SodiumException |
424 | 398 | * @throws \TypeError |
425 | 399 | */ |
426 | - function crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
427 | - { |
|
400 | + function crypto_pwhash_str($passwd, $opslimit, $memlimit) { |
|
428 | 401 | return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
429 | 402 | } |
430 | 403 | } |
@@ -437,8 +410,7 @@ discard block |
||
437 | 410 | * @throws \SodiumException |
438 | 411 | * @throws \TypeError |
439 | 412 | */ |
440 | - function crypto_pwhash_str_verify($passwd, $hash) |
|
441 | - { |
|
413 | + function crypto_pwhash_str_verify($passwd, $hash) { |
|
442 | 414 | return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
443 | 415 | } |
444 | 416 | } |
@@ -454,8 +426,7 @@ discard block |
||
454 | 426 | * @throws \SodiumException |
455 | 427 | * @throws \TypeError |
456 | 428 | */ |
457 | - function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
458 | - { |
|
429 | + function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
459 | 430 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
460 | 431 | } |
461 | 432 | } |
@@ -469,8 +440,7 @@ discard block |
||
469 | 440 | * @throws \SodiumException |
470 | 441 | * @throws \TypeError |
471 | 442 | */ |
472 | - function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
473 | - { |
|
443 | + function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) { |
|
474 | 444 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
475 | 445 | } |
476 | 446 | } |
@@ -483,8 +453,7 @@ discard block |
||
483 | 453 | * @throws \SodiumException |
484 | 454 | * @throws \TypeError |
485 | 455 | */ |
486 | - function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
487 | - { |
|
456 | + function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) { |
|
488 | 457 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
489 | 458 | } |
490 | 459 | } |
@@ -497,8 +466,7 @@ discard block |
||
497 | 466 | * @throws \SodiumException |
498 | 467 | * @throws \TypeError |
499 | 468 | */ |
500 | - function crypto_scalarmult($n, $p) |
|
501 | - { |
|
469 | + function crypto_scalarmult($n, $p) { |
|
502 | 470 | return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
503 | 471 | } |
504 | 472 | } |
@@ -510,8 +478,7 @@ discard block |
||
510 | 478 | * @throws \SodiumException |
511 | 479 | * @throws \TypeError |
512 | 480 | */ |
513 | - function crypto_scalarmult_base($n) |
|
514 | - { |
|
481 | + function crypto_scalarmult_base($n) { |
|
515 | 482 | return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
516 | 483 | } |
517 | 484 | } |
@@ -525,8 +492,7 @@ discard block |
||
525 | 492 | * @throws \SodiumException |
526 | 493 | * @throws \TypeError |
527 | 494 | */ |
528 | - function crypto_secretbox($message, $nonce, $key) |
|
529 | - { |
|
495 | + function crypto_secretbox($message, $nonce, $key) { |
|
530 | 496 | return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
531 | 497 | } |
532 | 498 | } |
@@ -538,8 +504,7 @@ discard block |
||
538 | 504 | * @param string $key |
539 | 505 | * @return string|bool |
540 | 506 | */ |
541 | - function crypto_secretbox_open($message, $nonce, $key) |
|
542 | - { |
|
507 | + function crypto_secretbox_open($message, $nonce, $key) { |
|
543 | 508 | try { |
544 | 509 | return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
545 | 510 | } catch (\TypeError $ex) { |
@@ -558,8 +523,7 @@ discard block |
||
558 | 523 | * @throws \SodiumException |
559 | 524 | * @throws \TypeError |
560 | 525 | */ |
561 | - function crypto_shorthash($message, $key = '') |
|
562 | - { |
|
526 | + function crypto_shorthash($message, $key = '') { |
|
563 | 527 | return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
564 | 528 | } |
565 | 529 | } |
@@ -572,8 +536,7 @@ discard block |
||
572 | 536 | * @throws \SodiumException |
573 | 537 | * @throws \TypeError |
574 | 538 | */ |
575 | - function crypto_sign($message, $sk) |
|
576 | - { |
|
539 | + function crypto_sign($message, $sk) { |
|
577 | 540 | return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
578 | 541 | } |
579 | 542 | } |
@@ -586,8 +549,7 @@ discard block |
||
586 | 549 | * @throws \SodiumException |
587 | 550 | * @throws \TypeError |
588 | 551 | */ |
589 | - function crypto_sign_detached($message, $sk) |
|
590 | - { |
|
552 | + function crypto_sign_detached($message, $sk) { |
|
591 | 553 | return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
592 | 554 | } |
593 | 555 | } |
@@ -598,8 +560,7 @@ discard block |
||
598 | 560 | * @throws \SodiumException |
599 | 561 | * @throws \TypeError |
600 | 562 | */ |
601 | - function crypto_sign_keypair() |
|
602 | - { |
|
563 | + function crypto_sign_keypair() { |
|
603 | 564 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
604 | 565 | } |
605 | 566 | } |
@@ -610,8 +571,7 @@ discard block |
||
610 | 571 | * @param string $pk |
611 | 572 | * @return string|bool |
612 | 573 | */ |
613 | - function crypto_sign_open($signedMessage, $pk) |
|
614 | - { |
|
574 | + function crypto_sign_open($signedMessage, $pk) { |
|
615 | 575 | try { |
616 | 576 | return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
617 | 577 | } catch (\TypeError $ex) { |
@@ -629,8 +589,7 @@ discard block |
||
629 | 589 | * @throws \SodiumException |
630 | 590 | * @throws \TypeError |
631 | 591 | */ |
632 | - function crypto_sign_publickey($keypair) |
|
633 | - { |
|
592 | + function crypto_sign_publickey($keypair) { |
|
634 | 593 | return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
635 | 594 | } |
636 | 595 | } |
@@ -642,8 +601,7 @@ discard block |
||
642 | 601 | * @throws \SodiumException |
643 | 602 | * @throws \TypeError |
644 | 603 | */ |
645 | - function crypto_sign_publickey_from_secretkey($sk) |
|
646 | - { |
|
604 | + function crypto_sign_publickey_from_secretkey($sk) { |
|
647 | 605 | return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
648 | 606 | } |
649 | 607 | } |
@@ -655,8 +613,7 @@ discard block |
||
655 | 613 | * @throws \SodiumException |
656 | 614 | * @throws \TypeError |
657 | 615 | */ |
658 | - function crypto_sign_secretkey($keypair) |
|
659 | - { |
|
616 | + function crypto_sign_secretkey($keypair) { |
|
660 | 617 | return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
661 | 618 | } |
662 | 619 | } |
@@ -668,8 +625,7 @@ discard block |
||
668 | 625 | * @throws \SodiumException |
669 | 626 | * @throws \TypeError |
670 | 627 | */ |
671 | - function crypto_sign_seed_keypair($seed) |
|
672 | - { |
|
628 | + function crypto_sign_seed_keypair($seed) { |
|
673 | 629 | return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
674 | 630 | } |
675 | 631 | } |
@@ -683,8 +639,7 @@ discard block |
||
683 | 639 | * @throws \SodiumException |
684 | 640 | * @throws \TypeError |
685 | 641 | */ |
686 | - function crypto_sign_verify_detached($signature, $message, $pk) |
|
687 | - { |
|
642 | + function crypto_sign_verify_detached($signature, $message, $pk) { |
|
688 | 643 | return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
689 | 644 | } |
690 | 645 | } |
@@ -696,8 +651,7 @@ discard block |
||
696 | 651 | * @throws \SodiumException |
697 | 652 | * @throws \TypeError |
698 | 653 | */ |
699 | - function crypto_sign_ed25519_pk_to_curve25519($pk) |
|
700 | - { |
|
654 | + function crypto_sign_ed25519_pk_to_curve25519($pk) { |
|
701 | 655 | return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($pk); |
702 | 656 | } |
703 | 657 | } |
@@ -709,8 +663,7 @@ discard block |
||
709 | 663 | * @throws \SodiumException |
710 | 664 | * @throws \TypeError |
711 | 665 | */ |
712 | - function crypto_sign_ed25519_sk_to_curve25519($sk) |
|
713 | - { |
|
666 | + function crypto_sign_ed25519_sk_to_curve25519($sk) { |
|
714 | 667 | return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
715 | 668 | } |
716 | 669 | } |
@@ -724,8 +677,7 @@ discard block |
||
724 | 677 | * @throws \SodiumException |
725 | 678 | * @throws \TypeError |
726 | 679 | */ |
727 | - function crypto_stream($len, $nonce, $key) |
|
728 | - { |
|
680 | + function crypto_stream($len, $nonce, $key) { |
|
729 | 681 | return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
730 | 682 | } |
731 | 683 | } |
@@ -739,8 +691,7 @@ discard block |
||
739 | 691 | * @throws \SodiumException |
740 | 692 | * @throws \TypeError |
741 | 693 | */ |
742 | - function crypto_stream_xor($message, $nonce, $key) |
|
743 | - { |
|
694 | + function crypto_stream_xor($message, $nonce, $key) { |
|
744 | 695 | return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
745 | 696 | } |
746 | 697 | } |
@@ -752,8 +703,7 @@ discard block |
||
752 | 703 | * @throws \SodiumException |
753 | 704 | * @throws \TypeError |
754 | 705 | */ |
755 | - function hex2bin($string) |
|
756 | - { |
|
706 | + function hex2bin($string) { |
|
757 | 707 | return ParagonIE_Sodium_Compat::hex2bin($string); |
758 | 708 | } |
759 | 709 | } |
@@ -766,8 +716,7 @@ discard block |
||
766 | 716 | * @throws \SodiumException |
767 | 717 | * @throws \TypeError |
768 | 718 | */ |
769 | - function memcmp($a, $b) |
|
770 | - { |
|
719 | + function memcmp($a, $b) { |
|
771 | 720 | return ParagonIE_Sodium_Compat::memcmp($a, $b); |
772 | 721 | } |
773 | 722 | } |
@@ -779,8 +728,7 @@ discard block |
||
779 | 728 | * @throws \SodiumException |
780 | 729 | * @throws \TypeError |
781 | 730 | */ |
782 | - function memzero(&$str) |
|
783 | - { |
|
731 | + function memzero(&$str) { |
|
784 | 732 | ParagonIE_Sodium_Compat::memzero($str); |
785 | 733 | } |
786 | 734 | } |
@@ -791,8 +739,7 @@ discard block |
||
791 | 739 | * @return string |
792 | 740 | * @throws \TypeError |
793 | 741 | */ |
794 | - function randombytes_buf($amount) |
|
795 | - { |
|
742 | + function randombytes_buf($amount) { |
|
796 | 743 | return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
797 | 744 | } |
798 | 745 | } |
@@ -805,8 +752,7 @@ discard block |
||
805 | 752 | * @throws \SodiumException |
806 | 753 | * @throws \Error |
807 | 754 | */ |
808 | - function randombytes_uniform($upperLimit) |
|
809 | - { |
|
755 | + function randombytes_uniform($upperLimit) { |
|
810 | 756 | return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
811 | 757 | } |
812 | 758 | } |
@@ -816,8 +762,7 @@ discard block |
||
816 | 762 | * @see ParagonIE_Sodium_Compat::randombytes_random16() |
817 | 763 | * @return int |
818 | 764 | */ |
819 | - function randombytes_random16() |
|
820 | - { |
|
765 | + function randombytes_random16() { |
|
821 | 766 | return ParagonIE_Sodium_Compat::randombytes_random16(); |
822 | 767 | } |
823 | 768 | } |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | * @return string |
48 | 48 | * @throws SodiumException |
49 | 49 | */ |
50 | - function sodium_crypto_core_ristretto255_add($p, $q) |
|
51 | - { |
|
50 | + function sodium_crypto_core_ristretto255_add($p, $q) { |
|
52 | 51 | return ParagonIE_Sodium_Compat::ristretto255_add($p, $q, true); |
53 | 52 | } |
54 | 53 | } |
@@ -60,8 +59,7 @@ discard block |
||
60 | 59 | * @return string |
61 | 60 | * @throws SodiumException |
62 | 61 | */ |
63 | - function sodium_crypto_core_ristretto255_from_hash($r) |
|
64 | - { |
|
62 | + function sodium_crypto_core_ristretto255_from_hash($r) { |
|
65 | 63 | return ParagonIE_Sodium_Compat::ristretto255_from_hash($r, true); |
66 | 64 | } |
67 | 65 | } |
@@ -73,8 +71,7 @@ discard block |
||
73 | 71 | * @return bool |
74 | 72 | * @throws SodiumException |
75 | 73 | */ |
76 | - function sodium_crypto_core_ristretto255_is_valid_point($p) |
|
77 | - { |
|
74 | + function sodium_crypto_core_ristretto255_is_valid_point($p) { |
|
78 | 75 | return ParagonIE_Sodium_Compat::ristretto255_is_valid_point($p, true); |
79 | 76 | } |
80 | 77 | } |
@@ -85,8 +82,7 @@ discard block |
||
85 | 82 | * @return string |
86 | 83 | * @throws SodiumException |
87 | 84 | */ |
88 | - function sodium_crypto_core_ristretto255_random() |
|
89 | - { |
|
85 | + function sodium_crypto_core_ristretto255_random() { |
|
90 | 86 | return ParagonIE_Sodium_Compat::ristretto255_random(true); |
91 | 87 | } |
92 | 88 | } |
@@ -99,8 +95,7 @@ discard block |
||
99 | 95 | * @return string |
100 | 96 | * @throws SodiumException |
101 | 97 | */ |
102 | - function sodium_crypto_core_ristretto255_scalar_add($p, $q) |
|
103 | - { |
|
98 | + function sodium_crypto_core_ristretto255_scalar_add($p, $q) { |
|
104 | 99 | return ParagonIE_Sodium_Compat::ristretto255_scalar_add($p, $q, true); |
105 | 100 | } |
106 | 101 | } |
@@ -112,8 +107,7 @@ discard block |
||
112 | 107 | * @return string |
113 | 108 | * @throws SodiumException |
114 | 109 | */ |
115 | - function sodium_crypto_core_ristretto255_scalar_complement($p) |
|
116 | - { |
|
110 | + function sodium_crypto_core_ristretto255_scalar_complement($p) { |
|
117 | 111 | return ParagonIE_Sodium_Compat::ristretto255_scalar_complement($p, true); |
118 | 112 | } |
119 | 113 | } |
@@ -125,8 +119,7 @@ discard block |
||
125 | 119 | * @return string |
126 | 120 | * @throws SodiumException |
127 | 121 | */ |
128 | - function sodium_crypto_core_ristretto255_scalar_invert($p) |
|
129 | - { |
|
122 | + function sodium_crypto_core_ristretto255_scalar_invert($p) { |
|
130 | 123 | return ParagonIE_Sodium_Compat::ristretto255_scalar_invert($p, true); |
131 | 124 | } |
132 | 125 | } |
@@ -139,8 +132,7 @@ discard block |
||
139 | 132 | * @return string |
140 | 133 | * @throws SodiumException |
141 | 134 | */ |
142 | - function sodium_crypto_core_ristretto255_scalar_mul($p, $q) |
|
143 | - { |
|
135 | + function sodium_crypto_core_ristretto255_scalar_mul($p, $q) { |
|
144 | 136 | return ParagonIE_Sodium_Compat::ristretto255_scalar_mul($p, $q, true); |
145 | 137 | } |
146 | 138 | } |
@@ -152,8 +144,7 @@ discard block |
||
152 | 144 | * @return string |
153 | 145 | * @throws SodiumException |
154 | 146 | */ |
155 | - function sodium_crypto_core_ristretto255_scalar_negate($p) |
|
156 | - { |
|
147 | + function sodium_crypto_core_ristretto255_scalar_negate($p) { |
|
157 | 148 | return ParagonIE_Sodium_Compat::ristretto255_scalar_negate($p, true); |
158 | 149 | } |
159 | 150 | } |
@@ -164,8 +155,7 @@ discard block |
||
164 | 155 | * @return string |
165 | 156 | * @throws SodiumException |
166 | 157 | */ |
167 | - function sodium_crypto_core_ristretto255_scalar_random() |
|
168 | - { |
|
158 | + function sodium_crypto_core_ristretto255_scalar_random() { |
|
169 | 159 | return ParagonIE_Sodium_Compat::ristretto255_scalar_random(true); |
170 | 160 | } |
171 | 161 | } |
@@ -177,8 +167,7 @@ discard block |
||
177 | 167 | * @return string |
178 | 168 | * @throws SodiumException |
179 | 169 | */ |
180 | - function sodium_crypto_core_ristretto255_scalar_reduce($p) |
|
181 | - { |
|
170 | + function sodium_crypto_core_ristretto255_scalar_reduce($p) { |
|
182 | 171 | return ParagonIE_Sodium_Compat::ristretto255_scalar_reduce($p, true); |
183 | 172 | } |
184 | 173 | } |
@@ -191,8 +180,7 @@ discard block |
||
191 | 180 | * @return string |
192 | 181 | * @throws SodiumException |
193 | 182 | */ |
194 | - function sodium_crypto_core_ristretto255_scalar_sub($p, $q) |
|
195 | - { |
|
183 | + function sodium_crypto_core_ristretto255_scalar_sub($p, $q) { |
|
196 | 184 | return ParagonIE_Sodium_Compat::ristretto255_scalar_sub($p, $q, true); |
197 | 185 | } |
198 | 186 | } |
@@ -205,8 +193,7 @@ discard block |
||
205 | 193 | * @return string |
206 | 194 | * @throws SodiumException |
207 | 195 | */ |
208 | - function sodium_crypto_core_ristretto255_sub($p, $q) |
|
209 | - { |
|
196 | + function sodium_crypto_core_ristretto255_sub($p, $q) { |
|
210 | 197 | return ParagonIE_Sodium_Compat::ristretto255_sub($p, $q, true); |
211 | 198 | } |
212 | 199 | } |
@@ -219,8 +206,7 @@ discard block |
||
219 | 206 | * @throws SodiumException |
220 | 207 | * @throws TypeError |
221 | 208 | */ |
222 | - function sodium_crypto_scalarmult_ristretto255($n, $p) |
|
223 | - { |
|
209 | + function sodium_crypto_scalarmult_ristretto255($n, $p) { |
|
224 | 210 | return ParagonIE_Sodium_Compat::scalarmult_ristretto255($n, $p, true); |
225 | 211 | } |
226 | 212 | } |
@@ -232,8 +218,7 @@ discard block |
||
232 | 218 | * @throws SodiumException |
233 | 219 | * @throws TypeError |
234 | 220 | */ |
235 | - function sodium_crypto_scalarmult_ristretto255_base($n) |
|
236 | - { |
|
221 | + function sodium_crypto_scalarmult_ristretto255_base($n) { |
|
237 | 222 | return ParagonIE_Sodium_Compat::scalarmult_ristretto255_base($n, true); |
238 | 223 | } |
239 | 224 | } |
240 | 225 | \ No newline at end of file |
@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | * @throws SodiumException |
11 | 11 | * @throws TypeError |
12 | 12 | */ |
13 | - function sodium_crypto_stream_xchacha20($len, $nonce, $key) |
|
14 | - { |
|
13 | + function sodium_crypto_stream_xchacha20($len, $nonce, $key) { |
|
15 | 14 | return ParagonIE_Sodium_Compat::crypto_stream_xchacha20($len, $nonce, $key, true); |
16 | 15 | } |
17 | 16 | } |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | * @return string |
22 | 21 | * @throws Exception |
23 | 22 | */ |
24 | - function sodium_crypto_stream_xchacha20_keygen() |
|
25 | - { |
|
23 | + function sodium_crypto_stream_xchacha20_keygen() { |
|
26 | 24 | return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_keygen(); |
27 | 25 | } |
28 | 26 | } |
@@ -36,8 +34,7 @@ discard block |
||
36 | 34 | * @throws SodiumException |
37 | 35 | * @throws TypeError |
38 | 36 | */ |
39 | - function sodium_crypto_stream_xchacha20_xor($message, $nonce, $key) |
|
40 | - { |
|
37 | + function sodium_crypto_stream_xchacha20_xor($message, $nonce, $key) { |
|
41 | 38 | return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor($message, $nonce, $key, true); |
42 | 39 | } |
43 | 40 | } |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | * @throws SodiumException |
117 | 117 | */ |
118 | - function sodium_add(&$val, $addv) |
|
119 | - { |
|
118 | + function sodium_add(&$val, $addv) { |
|
120 | 119 | ParagonIE_Sodium_Compat::add($val, $addv); |
121 | 120 | } |
122 | 121 | } |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | * @throws SodiumException |
131 | 130 | * @throws TypeError |
132 | 131 | */ |
133 | - function sodium_base642bin($string, $variant, $ignore ='') |
|
134 | - { |
|
132 | + function sodium_base642bin($string, $variant, $ignore ='') { |
|
135 | 133 | return ParagonIE_Sodium_Compat::base642bin($string, $variant, $ignore); |
136 | 134 | } |
137 | 135 | } |
@@ -144,8 +142,7 @@ discard block |
||
144 | 142 | * @throws SodiumException |
145 | 143 | * @throws TypeError |
146 | 144 | */ |
147 | - function sodium_bin2base64($string, $variant) |
|
148 | - { |
|
145 | + function sodium_bin2base64($string, $variant) { |
|
149 | 146 | return ParagonIE_Sodium_Compat::bin2base64($string, $variant); |
150 | 147 | } |
151 | 148 | } |
@@ -157,8 +154,7 @@ discard block |
||
157 | 154 | * @throws SodiumException |
158 | 155 | * @throws TypeError |
159 | 156 | */ |
160 | - function sodium_bin2hex($string) |
|
161 | - { |
|
157 | + function sodium_bin2hex($string) { |
|
162 | 158 | return ParagonIE_Sodium_Compat::bin2hex($string); |
163 | 159 | } |
164 | 160 | } |
@@ -171,8 +167,7 @@ discard block |
||
171 | 167 | * @throws SodiumException |
172 | 168 | * @throws TypeError |
173 | 169 | */ |
174 | - function sodium_compare($a, $b) |
|
175 | - { |
|
170 | + function sodium_compare($a, $b) { |
|
176 | 171 | return ParagonIE_Sodium_Compat::compare($a, $b); |
177 | 172 | } |
178 | 173 | } |
@@ -185,8 +180,7 @@ discard block |
||
185 | 180 | * @param string $key |
186 | 181 | * @return string|bool |
187 | 182 | */ |
188 | - function sodium_crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) |
|
189 | - { |
|
183 | + function sodium_crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) { |
|
190 | 184 | try { |
191 | 185 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key); |
192 | 186 | } catch (Error $ex) { |
@@ -207,8 +201,7 @@ discard block |
||
207 | 201 | * @throws SodiumException |
208 | 202 | * @throws TypeError |
209 | 203 | */ |
210 | - function sodium_crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) |
|
211 | - { |
|
204 | + function sodium_crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) { |
|
212 | 205 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key); |
213 | 206 | } |
214 | 207 | } |
@@ -217,8 +210,7 @@ discard block |
||
217 | 210 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available() |
218 | 211 | * @return bool |
219 | 212 | */ |
220 | - function sodium_crypto_aead_aes256gcm_is_available() |
|
221 | - { |
|
213 | + function sodium_crypto_aead_aes256gcm_is_available() { |
|
222 | 214 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available(); |
223 | 215 | } |
224 | 216 | } |
@@ -231,8 +223,7 @@ discard block |
||
231 | 223 | * @param string $key |
232 | 224 | * @return string|bool |
233 | 225 | */ |
234 | - function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
235 | - { |
|
226 | + function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) { |
|
236 | 227 | try { |
237 | 228 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
238 | 229 | } catch (Error $ex) { |
@@ -253,8 +244,7 @@ discard block |
||
253 | 244 | * @throws SodiumException |
254 | 245 | * @throws TypeError |
255 | 246 | */ |
256 | - function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
257 | - { |
|
247 | + function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) { |
|
258 | 248 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
259 | 249 | } |
260 | 250 | } |
@@ -264,8 +254,7 @@ discard block |
||
264 | 254 | * @return string |
265 | 255 | * @throws Exception |
266 | 256 | */ |
267 | - function sodium_crypto_aead_chacha20poly1305_keygen() |
|
268 | - { |
|
257 | + function sodium_crypto_aead_chacha20poly1305_keygen() { |
|
269 | 258 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen(); |
270 | 259 | } |
271 | 260 | } |
@@ -278,8 +267,7 @@ discard block |
||
278 | 267 | * @param string $key |
279 | 268 | * @return string|bool |
280 | 269 | */ |
281 | - function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
282 | - { |
|
270 | + function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) { |
|
283 | 271 | try { |
284 | 272 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
285 | 273 | } catch (Error $ex) { |
@@ -300,8 +288,7 @@ discard block |
||
300 | 288 | * @throws SodiumException |
301 | 289 | * @throws TypeError |
302 | 290 | */ |
303 | - function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
304 | - { |
|
291 | + function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) { |
|
305 | 292 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
306 | 293 | } |
307 | 294 | } |
@@ -311,8 +298,7 @@ discard block |
||
311 | 298 | * @return string |
312 | 299 | * @throws Exception |
313 | 300 | */ |
314 | - function sodium_crypto_aead_chacha20poly1305_ietf_keygen() |
|
315 | - { |
|
301 | + function sodium_crypto_aead_chacha20poly1305_ietf_keygen() { |
|
316 | 302 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen(); |
317 | 303 | } |
318 | 304 | } |
@@ -325,8 +311,7 @@ discard block |
||
325 | 311 | * @param string $key |
326 | 312 | * @return string|bool |
327 | 313 | */ |
328 | - function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
329 | - { |
|
314 | + function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) { |
|
330 | 315 | try { |
331 | 316 | return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key, true); |
332 | 317 | } catch (Error $ex) { |
@@ -347,8 +332,7 @@ discard block |
||
347 | 332 | * @throws SodiumException |
348 | 333 | * @throws TypeError |
349 | 334 | */ |
350 | - function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
351 | - { |
|
335 | + function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) { |
|
352 | 336 | return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key, true); |
353 | 337 | } |
354 | 338 | } |
@@ -358,8 +342,7 @@ discard block |
||
358 | 342 | * @return string |
359 | 343 | * @throws Exception |
360 | 344 | */ |
361 | - function sodium_crypto_aead_xchacha20poly1305_ietf_keygen() |
|
362 | - { |
|
345 | + function sodium_crypto_aead_xchacha20poly1305_ietf_keygen() { |
|
363 | 346 | return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen(); |
364 | 347 | } |
365 | 348 | } |
@@ -372,8 +355,7 @@ discard block |
||
372 | 355 | * @throws SodiumException |
373 | 356 | * @throws TypeError |
374 | 357 | */ |
375 | - function sodium_crypto_auth($message, $key) |
|
376 | - { |
|
358 | + function sodium_crypto_auth($message, $key) { |
|
377 | 359 | return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
378 | 360 | } |
379 | 361 | } |
@@ -383,8 +365,7 @@ discard block |
||
383 | 365 | * @return string |
384 | 366 | * @throws Exception |
385 | 367 | */ |
386 | - function sodium_crypto_auth_keygen() |
|
387 | - { |
|
368 | + function sodium_crypto_auth_keygen() { |
|
388 | 369 | return ParagonIE_Sodium_Compat::crypto_auth_keygen(); |
389 | 370 | } |
390 | 371 | } |
@@ -398,8 +379,7 @@ discard block |
||
398 | 379 | * @throws SodiumException |
399 | 380 | * @throws TypeError |
400 | 381 | */ |
401 | - function sodium_crypto_auth_verify($mac, $message, $key) |
|
402 | - { |
|
382 | + function sodium_crypto_auth_verify($mac, $message, $key) { |
|
403 | 383 | return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
404 | 384 | } |
405 | 385 | } |
@@ -413,8 +393,7 @@ discard block |
||
413 | 393 | * @throws SodiumException |
414 | 394 | * @throws TypeError |
415 | 395 | */ |
416 | - function sodium_crypto_box($message, $nonce, $kp) |
|
417 | - { |
|
396 | + function sodium_crypto_box($message, $nonce, $kp) { |
|
418 | 397 | return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
419 | 398 | } |
420 | 399 | } |
@@ -425,8 +404,7 @@ discard block |
||
425 | 404 | * @throws SodiumException |
426 | 405 | * @throws TypeError |
427 | 406 | */ |
428 | - function sodium_crypto_box_keypair() |
|
429 | - { |
|
407 | + function sodium_crypto_box_keypair() { |
|
430 | 408 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
431 | 409 | } |
432 | 410 | } |
@@ -439,8 +417,7 @@ discard block |
||
439 | 417 | * @throws SodiumException |
440 | 418 | * @throws TypeError |
441 | 419 | */ |
442 | - function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
443 | - { |
|
420 | + function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) { |
|
444 | 421 | return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
445 | 422 | } |
446 | 423 | } |
@@ -452,8 +429,7 @@ discard block |
||
452 | 429 | * @param string $kp |
453 | 430 | * @return string|bool |
454 | 431 | */ |
455 | - function sodium_crypto_box_open($message, $nonce, $kp) |
|
456 | - { |
|
432 | + function sodium_crypto_box_open($message, $nonce, $kp) { |
|
457 | 433 | try { |
458 | 434 | return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
459 | 435 | } catch (Error $ex) { |
@@ -471,8 +447,7 @@ discard block |
||
471 | 447 | * @throws SodiumException |
472 | 448 | * @throws TypeError |
473 | 449 | */ |
474 | - function sodium_crypto_box_publickey($keypair) |
|
475 | - { |
|
450 | + function sodium_crypto_box_publickey($keypair) { |
|
476 | 451 | return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
477 | 452 | } |
478 | 453 | } |
@@ -484,8 +459,7 @@ discard block |
||
484 | 459 | * @throws SodiumException |
485 | 460 | * @throws TypeError |
486 | 461 | */ |
487 | - function sodium_crypto_box_publickey_from_secretkey($sk) |
|
488 | - { |
|
462 | + function sodium_crypto_box_publickey_from_secretkey($sk) { |
|
489 | 463 | return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
490 | 464 | } |
491 | 465 | } |
@@ -498,8 +472,7 @@ discard block |
||
498 | 472 | * @throws SodiumException |
499 | 473 | * @throws TypeError |
500 | 474 | */ |
501 | - function sodium_crypto_box_seal($message, $publicKey) |
|
502 | - { |
|
475 | + function sodium_crypto_box_seal($message, $publicKey) { |
|
503 | 476 | return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
504 | 477 | } |
505 | 478 | } |
@@ -511,8 +484,7 @@ discard block |
||
511 | 484 | * @return string|bool |
512 | 485 | * @throws SodiumException |
513 | 486 | */ |
514 | - function sodium_crypto_box_seal_open($message, $kp) |
|
515 | - { |
|
487 | + function sodium_crypto_box_seal_open($message, $kp) { |
|
516 | 488 | try { |
517 | 489 | return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
518 | 490 | } catch (SodiumException $ex) { |
@@ -531,8 +503,7 @@ discard block |
||
531 | 503 | * @throws SodiumException |
532 | 504 | * @throws TypeError |
533 | 505 | */ |
534 | - function sodium_crypto_box_secretkey($keypair) |
|
535 | - { |
|
506 | + function sodium_crypto_box_secretkey($keypair) { |
|
536 | 507 | return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
537 | 508 | } |
538 | 509 | } |
@@ -544,8 +515,7 @@ discard block |
||
544 | 515 | * @throws SodiumException |
545 | 516 | * @throws TypeError |
546 | 517 | */ |
547 | - function sodium_crypto_box_seed_keypair($seed) |
|
548 | - { |
|
518 | + function sodium_crypto_box_seed_keypair($seed) { |
|
549 | 519 | return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); |
550 | 520 | } |
551 | 521 | } |
@@ -559,8 +529,7 @@ discard block |
||
559 | 529 | * @throws SodiumException |
560 | 530 | * @throws TypeError |
561 | 531 | */ |
562 | - function sodium_crypto_generichash($message, $key = null, $outLen = 32) |
|
563 | - { |
|
532 | + function sodium_crypto_generichash($message, $key = null, $outLen = 32) { |
|
564 | 533 | return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
565 | 534 | } |
566 | 535 | } |
@@ -573,8 +542,7 @@ discard block |
||
573 | 542 | * @throws SodiumException |
574 | 543 | * @throws TypeError |
575 | 544 | */ |
576 | - function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) |
|
577 | - { |
|
545 | + function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) { |
|
578 | 546 | return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
579 | 547 | } |
580 | 548 | } |
@@ -587,8 +555,7 @@ discard block |
||
587 | 555 | * @throws SodiumException |
588 | 556 | * @throws TypeError |
589 | 557 | */ |
590 | - function sodium_crypto_generichash_init($key = null, $outLen = 32) |
|
591 | - { |
|
558 | + function sodium_crypto_generichash_init($key = null, $outLen = 32) { |
|
592 | 559 | return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
593 | 560 | } |
594 | 561 | } |
@@ -598,8 +565,7 @@ discard block |
||
598 | 565 | * @return string |
599 | 566 | * @throws Exception |
600 | 567 | */ |
601 | - function sodium_crypto_generichash_keygen() |
|
602 | - { |
|
568 | + function sodium_crypto_generichash_keygen() { |
|
603 | 569 | return ParagonIE_Sodium_Compat::crypto_generichash_keygen(); |
604 | 570 | } |
605 | 571 | } |
@@ -612,8 +578,7 @@ discard block |
||
612 | 578 | * @throws SodiumException |
613 | 579 | * @throws TypeError |
614 | 580 | */ |
615 | - function sodium_crypto_generichash_update(&$ctx, $message = '') |
|
616 | - { |
|
581 | + function sodium_crypto_generichash_update(&$ctx, $message = '') { |
|
617 | 582 | ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
618 | 583 | } |
619 | 584 | } |
@@ -623,8 +588,7 @@ discard block |
||
623 | 588 | * @return string |
624 | 589 | * @throws Exception |
625 | 590 | */ |
626 | - function sodium_crypto_kdf_keygen() |
|
627 | - { |
|
591 | + function sodium_crypto_kdf_keygen() { |
|
628 | 592 | return ParagonIE_Sodium_Compat::crypto_kdf_keygen(); |
629 | 593 | } |
630 | 594 | } |
@@ -638,8 +602,7 @@ discard block |
||
638 | 602 | * @return string |
639 | 603 | * @throws Exception |
640 | 604 | */ |
641 | - function sodium_crypto_kdf_derive_from_key($subkey_len, $subkey_id, $context, $key) |
|
642 | - { |
|
605 | + function sodium_crypto_kdf_derive_from_key($subkey_len, $subkey_id, $context, $key) { |
|
643 | 606 | return ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key( |
644 | 607 | $subkey_len, |
645 | 608 | $subkey_id, |
@@ -659,8 +622,7 @@ discard block |
||
659 | 622 | * @throws SodiumException |
660 | 623 | * @throws TypeError |
661 | 624 | */ |
662 | - function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
663 | - { |
|
625 | + function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) { |
|
664 | 626 | return ParagonIE_Sodium_Compat::crypto_kx( |
665 | 627 | $my_secret, |
666 | 628 | $their_public, |
@@ -675,8 +637,7 @@ discard block |
||
675 | 637 | * @return string |
676 | 638 | * @throws Exception |
677 | 639 | */ |
678 | - function sodium_crypto_kx_seed_keypair($seed) |
|
679 | - { |
|
640 | + function sodium_crypto_kx_seed_keypair($seed) { |
|
680 | 641 | return ParagonIE_Sodium_Compat::crypto_kx_seed_keypair($seed); |
681 | 642 | } |
682 | 643 | } |
@@ -685,8 +646,7 @@ discard block |
||
685 | 646 | * @return string |
686 | 647 | * @throws Exception |
687 | 648 | */ |
688 | - function sodium_crypto_kx_keypair() |
|
689 | - { |
|
649 | + function sodium_crypto_kx_keypair() { |
|
690 | 650 | return ParagonIE_Sodium_Compat::crypto_kx_keypair(); |
691 | 651 | } |
692 | 652 | } |
@@ -697,8 +657,7 @@ discard block |
||
697 | 657 | * @return array{0: string, 1: string} |
698 | 658 | * @throws SodiumException |
699 | 659 | */ |
700 | - function sodium_crypto_kx_client_session_keys($keypair, $serverPublicKey) |
|
701 | - { |
|
660 | + function sodium_crypto_kx_client_session_keys($keypair, $serverPublicKey) { |
|
702 | 661 | return ParagonIE_Sodium_Compat::crypto_kx_client_session_keys($keypair, $serverPublicKey); |
703 | 662 | } |
704 | 663 | } |
@@ -709,8 +668,7 @@ discard block |
||
709 | 668 | * @return array{0: string, 1: string} |
710 | 669 | * @throws SodiumException |
711 | 670 | */ |
712 | - function sodium_crypto_kx_server_session_keys($keypair, $clientPublicKey) |
|
713 | - { |
|
671 | + function sodium_crypto_kx_server_session_keys($keypair, $clientPublicKey) { |
|
714 | 672 | return ParagonIE_Sodium_Compat::crypto_kx_server_session_keys($keypair, $clientPublicKey); |
715 | 673 | } |
716 | 674 | } |
@@ -720,8 +678,7 @@ discard block |
||
720 | 678 | * @return string |
721 | 679 | * @throws Exception |
722 | 680 | */ |
723 | - function sodium_crypto_kx_secretkey($keypair) |
|
724 | - { |
|
681 | + function sodium_crypto_kx_secretkey($keypair) { |
|
725 | 682 | return ParagonIE_Sodium_Compat::crypto_kx_secretkey($keypair); |
726 | 683 | } |
727 | 684 | } |
@@ -731,8 +688,7 @@ discard block |
||
731 | 688 | * @return string |
732 | 689 | * @throws Exception |
733 | 690 | */ |
734 | - function sodium_crypto_kx_publickey($keypair) |
|
735 | - { |
|
691 | + function sodium_crypto_kx_publickey($keypair) { |
|
736 | 692 | return ParagonIE_Sodium_Compat::crypto_kx_publickey($keypair); |
737 | 693 | } |
738 | 694 | } |
@@ -749,8 +705,7 @@ discard block |
||
749 | 705 | * @throws SodiumException |
750 | 706 | * @throws TypeError |
751 | 707 | */ |
752 | - function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $algo = null) |
|
753 | - { |
|
708 | + function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $algo = null) { |
|
754 | 709 | return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $algo); |
755 | 710 | } |
756 | 711 | } |
@@ -764,8 +719,7 @@ discard block |
||
764 | 719 | * @throws SodiumException |
765 | 720 | * @throws TypeError |
766 | 721 | */ |
767 | - function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
768 | - { |
|
722 | + function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) { |
|
769 | 723 | return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
770 | 724 | } |
771 | 725 | } |
@@ -779,8 +733,7 @@ discard block |
||
779 | 733 | * |
780 | 734 | * @throws SodiumException |
781 | 735 | */ |
782 | - function sodium_crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit) |
|
783 | - { |
|
736 | + function sodium_crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit) { |
|
784 | 737 | return ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit); |
785 | 738 | } |
786 | 739 | } |
@@ -793,8 +746,7 @@ discard block |
||
793 | 746 | * @throws SodiumException |
794 | 747 | * @throws TypeError |
795 | 748 | */ |
796 | - function sodium_crypto_pwhash_str_verify($passwd, $hash) |
|
797 | - { |
|
749 | + function sodium_crypto_pwhash_str_verify($passwd, $hash) { |
|
798 | 750 | return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
799 | 751 | } |
800 | 752 | } |
@@ -810,8 +762,7 @@ discard block |
||
810 | 762 | * @throws SodiumException |
811 | 763 | * @throws TypeError |
812 | 764 | */ |
813 | - function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
814 | - { |
|
765 | + function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
815 | 766 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
816 | 767 | } |
817 | 768 | } |
@@ -825,8 +776,7 @@ discard block |
||
825 | 776 | * @throws SodiumException |
826 | 777 | * @throws TypeError |
827 | 778 | */ |
828 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
829 | - { |
|
779 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) { |
|
830 | 780 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
831 | 781 | } |
832 | 782 | } |
@@ -839,8 +789,7 @@ discard block |
||
839 | 789 | * @throws SodiumException |
840 | 790 | * @throws TypeError |
841 | 791 | */ |
842 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
843 | - { |
|
792 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) { |
|
844 | 793 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
845 | 794 | } |
846 | 795 | } |
@@ -853,8 +802,7 @@ discard block |
||
853 | 802 | * @throws SodiumException |
854 | 803 | * @throws TypeError |
855 | 804 | */ |
856 | - function sodium_crypto_scalarmult($n, $p) |
|
857 | - { |
|
805 | + function sodium_crypto_scalarmult($n, $p) { |
|
858 | 806 | return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
859 | 807 | } |
860 | 808 | } |
@@ -866,8 +814,7 @@ discard block |
||
866 | 814 | * @throws SodiumException |
867 | 815 | * @throws TypeError |
868 | 816 | */ |
869 | - function sodium_crypto_scalarmult_base($n) |
|
870 | - { |
|
817 | + function sodium_crypto_scalarmult_base($n) { |
|
871 | 818 | return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
872 | 819 | } |
873 | 820 | } |
@@ -881,8 +828,7 @@ discard block |
||
881 | 828 | * @throws SodiumException |
882 | 829 | * @throws TypeError |
883 | 830 | */ |
884 | - function sodium_crypto_secretbox($message, $nonce, $key) |
|
885 | - { |
|
831 | + function sodium_crypto_secretbox($message, $nonce, $key) { |
|
886 | 832 | return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
887 | 833 | } |
888 | 834 | } |
@@ -892,8 +838,7 @@ discard block |
||
892 | 838 | * @return string |
893 | 839 | * @throws Exception |
894 | 840 | */ |
895 | - function sodium_crypto_secretbox_keygen() |
|
896 | - { |
|
841 | + function sodium_crypto_secretbox_keygen() { |
|
897 | 842 | return ParagonIE_Sodium_Compat::crypto_secretbox_keygen(); |
898 | 843 | } |
899 | 844 | } |
@@ -905,8 +850,7 @@ discard block |
||
905 | 850 | * @param string $key |
906 | 851 | * @return string|bool |
907 | 852 | */ |
908 | - function sodium_crypto_secretbox_open($message, $nonce, $key) |
|
909 | - { |
|
853 | + function sodium_crypto_secretbox_open($message, $nonce, $key) { |
|
910 | 854 | try { |
911 | 855 | return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
912 | 856 | } catch (Error $ex) { |
@@ -922,8 +866,7 @@ discard block |
||
922 | 866 | * @return array<int, string> |
923 | 867 | * @throws SodiumException |
924 | 868 | */ |
925 | - function sodium_crypto_secretstream_xchacha20poly1305_init_push($key) |
|
926 | - { |
|
869 | + function sodium_crypto_secretstream_xchacha20poly1305_init_push($key) { |
|
927 | 870 | return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_push($key); |
928 | 871 | } |
929 | 872 | } |
@@ -936,8 +879,7 @@ discard block |
||
936 | 879 | * @return string |
937 | 880 | * @throws SodiumException |
938 | 881 | */ |
939 | - function sodium_crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) |
|
940 | - { |
|
882 | + function sodium_crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) { |
|
941 | 883 | return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_push($state, $msg, $aad, $tag); |
942 | 884 | } |
943 | 885 | } |
@@ -948,8 +890,7 @@ discard block |
||
948 | 890 | * @return string |
949 | 891 | * @throws Exception |
950 | 892 | */ |
951 | - function sodium_crypto_secretstream_xchacha20poly1305_init_pull($header, $key) |
|
952 | - { |
|
893 | + function sodium_crypto_secretstream_xchacha20poly1305_init_pull($header, $key) { |
|
953 | 894 | return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull($header, $key); |
954 | 895 | } |
955 | 896 | } |
@@ -961,8 +902,7 @@ discard block |
||
961 | 902 | * @return bool|array{0: string, 1: int} |
962 | 903 | * @throws SodiumException |
963 | 904 | */ |
964 | - function sodium_crypto_secretstream_xchacha20poly1305_pull(&$state, $cipher, $aad = '') |
|
965 | - { |
|
905 | + function sodium_crypto_secretstream_xchacha20poly1305_pull(&$state, $cipher, $aad = '') { |
|
966 | 906 | return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull($state, $cipher, $aad); |
967 | 907 | } |
968 | 908 | } |
@@ -972,8 +912,7 @@ discard block |
||
972 | 912 | * @return void |
973 | 913 | * @throws SodiumException |
974 | 914 | */ |
975 | - function sodium_crypto_secretstream_xchacha20poly1305_rekey(&$state) |
|
976 | - { |
|
915 | + function sodium_crypto_secretstream_xchacha20poly1305_rekey(&$state) { |
|
977 | 916 | ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey($state); |
978 | 917 | } |
979 | 918 | } |
@@ -982,8 +921,7 @@ discard block |
||
982 | 921 | * @return string |
983 | 922 | * @throws Exception |
984 | 923 | */ |
985 | - function sodium_crypto_secretstream_xchacha20poly1305_keygen() |
|
986 | - { |
|
924 | + function sodium_crypto_secretstream_xchacha20poly1305_keygen() { |
|
987 | 925 | return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_keygen(); |
988 | 926 | } |
989 | 927 | } |
@@ -996,8 +934,7 @@ discard block |
||
996 | 934 | * @throws SodiumException |
997 | 935 | * @throws TypeError |
998 | 936 | */ |
999 | - function sodium_crypto_shorthash($message, $key = '') |
|
1000 | - { |
|
937 | + function sodium_crypto_shorthash($message, $key = '') { |
|
1001 | 938 | return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
1002 | 939 | } |
1003 | 940 | } |
@@ -1007,8 +944,7 @@ discard block |
||
1007 | 944 | * @return string |
1008 | 945 | * @throws Exception |
1009 | 946 | */ |
1010 | - function sodium_crypto_shorthash_keygen() |
|
1011 | - { |
|
947 | + function sodium_crypto_shorthash_keygen() { |
|
1012 | 948 | return ParagonIE_Sodium_Compat::crypto_shorthash_keygen(); |
1013 | 949 | } |
1014 | 950 | } |
@@ -1021,8 +957,7 @@ discard block |
||
1021 | 957 | * @throws SodiumException |
1022 | 958 | * @throws TypeError |
1023 | 959 | */ |
1024 | - function sodium_crypto_sign($message, $sk) |
|
1025 | - { |
|
960 | + function sodium_crypto_sign($message, $sk) { |
|
1026 | 961 | return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
1027 | 962 | } |
1028 | 963 | } |
@@ -1035,8 +970,7 @@ discard block |
||
1035 | 970 | * @throws SodiumException |
1036 | 971 | * @throws TypeError |
1037 | 972 | */ |
1038 | - function sodium_crypto_sign_detached($message, $sk) |
|
1039 | - { |
|
973 | + function sodium_crypto_sign_detached($message, $sk) { |
|
1040 | 974 | return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
1041 | 975 | } |
1042 | 976 | } |
@@ -1049,8 +983,7 @@ discard block |
||
1049 | 983 | * @throws SodiumException |
1050 | 984 | * @throws TypeError |
1051 | 985 | */ |
1052 | - function sodium_crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk) |
|
1053 | - { |
|
986 | + function sodium_crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk) { |
|
1054 | 987 | return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk); |
1055 | 988 | } |
1056 | 989 | } |
@@ -1061,8 +994,7 @@ discard block |
||
1061 | 994 | * @throws SodiumException |
1062 | 995 | * @throws TypeError |
1063 | 996 | */ |
1064 | - function sodium_crypto_sign_keypair() |
|
1065 | - { |
|
997 | + function sodium_crypto_sign_keypair() { |
|
1066 | 998 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
1067 | 999 | } |
1068 | 1000 | } |
@@ -1073,8 +1005,7 @@ discard block |
||
1073 | 1005 | * @param string $pk |
1074 | 1006 | * @return string|bool |
1075 | 1007 | */ |
1076 | - function sodium_crypto_sign_open($signedMessage, $pk) |
|
1077 | - { |
|
1008 | + function sodium_crypto_sign_open($signedMessage, $pk) { |
|
1078 | 1009 | try { |
1079 | 1010 | return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
1080 | 1011 | } catch (Error $ex) { |
@@ -1092,8 +1023,7 @@ discard block |
||
1092 | 1023 | * @throws SodiumException |
1093 | 1024 | * @throws TypeError |
1094 | 1025 | */ |
1095 | - function sodium_crypto_sign_publickey($keypair) |
|
1096 | - { |
|
1026 | + function sodium_crypto_sign_publickey($keypair) { |
|
1097 | 1027 | return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
1098 | 1028 | } |
1099 | 1029 | } |
@@ -1105,8 +1035,7 @@ discard block |
||
1105 | 1035 | * @throws SodiumException |
1106 | 1036 | * @throws TypeError |
1107 | 1037 | */ |
1108 | - function sodium_crypto_sign_publickey_from_secretkey($sk) |
|
1109 | - { |
|
1038 | + function sodium_crypto_sign_publickey_from_secretkey($sk) { |
|
1110 | 1039 | return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
1111 | 1040 | } |
1112 | 1041 | } |
@@ -1118,8 +1047,7 @@ discard block |
||
1118 | 1047 | * @throws SodiumException |
1119 | 1048 | * @throws TypeError |
1120 | 1049 | */ |
1121 | - function sodium_crypto_sign_secretkey($keypair) |
|
1122 | - { |
|
1050 | + function sodium_crypto_sign_secretkey($keypair) { |
|
1123 | 1051 | return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
1124 | 1052 | } |
1125 | 1053 | } |
@@ -1131,8 +1059,7 @@ discard block |
||
1131 | 1059 | * @throws SodiumException |
1132 | 1060 | * @throws TypeError |
1133 | 1061 | */ |
1134 | - function sodium_crypto_sign_seed_keypair($seed) |
|
1135 | - { |
|
1062 | + function sodium_crypto_sign_seed_keypair($seed) { |
|
1136 | 1063 | return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
1137 | 1064 | } |
1138 | 1065 | } |
@@ -1146,8 +1073,7 @@ discard block |
||
1146 | 1073 | * @throws SodiumException |
1147 | 1074 | * @throws TypeError |
1148 | 1075 | */ |
1149 | - function sodium_crypto_sign_verify_detached($signature, $message, $pk) |
|
1150 | - { |
|
1076 | + function sodium_crypto_sign_verify_detached($signature, $message, $pk) { |
|
1151 | 1077 | return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
1152 | 1078 | } |
1153 | 1079 | } |
@@ -1159,8 +1085,7 @@ discard block |
||
1159 | 1085 | * @throws SodiumException |
1160 | 1086 | * @throws TypeError |
1161 | 1087 | */ |
1162 | - function sodium_crypto_sign_ed25519_pk_to_curve25519($pk) |
|
1163 | - { |
|
1088 | + function sodium_crypto_sign_ed25519_pk_to_curve25519($pk) { |
|
1164 | 1089 | return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($pk); |
1165 | 1090 | } |
1166 | 1091 | } |
@@ -1172,8 +1097,7 @@ discard block |
||
1172 | 1097 | * @throws SodiumException |
1173 | 1098 | * @throws TypeError |
1174 | 1099 | */ |
1175 | - function sodium_crypto_sign_ed25519_sk_to_curve25519($sk) |
|
1176 | - { |
|
1100 | + function sodium_crypto_sign_ed25519_sk_to_curve25519($sk) { |
|
1177 | 1101 | return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
1178 | 1102 | } |
1179 | 1103 | } |
@@ -1187,8 +1111,7 @@ discard block |
||
1187 | 1111 | * @throws SodiumException |
1188 | 1112 | * @throws TypeError |
1189 | 1113 | */ |
1190 | - function sodium_crypto_stream($len, $nonce, $key) |
|
1191 | - { |
|
1114 | + function sodium_crypto_stream($len, $nonce, $key) { |
|
1192 | 1115 | return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
1193 | 1116 | } |
1194 | 1117 | } |
@@ -1198,8 +1121,7 @@ discard block |
||
1198 | 1121 | * @return string |
1199 | 1122 | * @throws Exception |
1200 | 1123 | */ |
1201 | - function sodium_crypto_stream_keygen() |
|
1202 | - { |
|
1124 | + function sodium_crypto_stream_keygen() { |
|
1203 | 1125 | return ParagonIE_Sodium_Compat::crypto_stream_keygen(); |
1204 | 1126 | } |
1205 | 1127 | } |
@@ -1213,8 +1135,7 @@ discard block |
||
1213 | 1135 | * @throws SodiumException |
1214 | 1136 | * @throws TypeError |
1215 | 1137 | */ |
1216 | - function sodium_crypto_stream_xor($message, $nonce, $key) |
|
1217 | - { |
|
1138 | + function sodium_crypto_stream_xor($message, $nonce, $key) { |
|
1218 | 1139 | return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
1219 | 1140 | } |
1220 | 1141 | } |
@@ -1227,8 +1148,7 @@ discard block |
||
1227 | 1148 | * @throws SodiumException |
1228 | 1149 | * @throws TypeError |
1229 | 1150 | */ |
1230 | - function sodium_hex2bin($string) |
|
1231 | - { |
|
1151 | + function sodium_hex2bin($string) { |
|
1232 | 1152 | return ParagonIE_Sodium_Compat::hex2bin($string); |
1233 | 1153 | } |
1234 | 1154 | } |
@@ -1240,8 +1160,7 @@ discard block |
||
1240 | 1160 | * @throws SodiumException |
1241 | 1161 | * @throws TypeError |
1242 | 1162 | */ |
1243 | - function sodium_increment(&$string) |
|
1244 | - { |
|
1163 | + function sodium_increment(&$string) { |
|
1245 | 1164 | ParagonIE_Sodium_Compat::increment($string); |
1246 | 1165 | } |
1247 | 1166 | } |
@@ -1250,8 +1169,7 @@ discard block |
||
1250 | 1169 | * @see ParagonIE_Sodium_Compat::library_version_major() |
1251 | 1170 | * @return int |
1252 | 1171 | */ |
1253 | - function sodium_library_version_major() |
|
1254 | - { |
|
1172 | + function sodium_library_version_major() { |
|
1255 | 1173 | return ParagonIE_Sodium_Compat::library_version_major(); |
1256 | 1174 | } |
1257 | 1175 | } |
@@ -1260,8 +1178,7 @@ discard block |
||
1260 | 1178 | * @see ParagonIE_Sodium_Compat::library_version_minor() |
1261 | 1179 | * @return int |
1262 | 1180 | */ |
1263 | - function sodium_library_version_minor() |
|
1264 | - { |
|
1181 | + function sodium_library_version_minor() { |
|
1265 | 1182 | return ParagonIE_Sodium_Compat::library_version_minor(); |
1266 | 1183 | } |
1267 | 1184 | } |
@@ -1270,8 +1187,7 @@ discard block |
||
1270 | 1187 | * @see ParagonIE_Sodium_Compat::version_string() |
1271 | 1188 | * @return string |
1272 | 1189 | */ |
1273 | - function sodium_version_string() |
|
1274 | - { |
|
1190 | + function sodium_version_string() { |
|
1275 | 1191 | return ParagonIE_Sodium_Compat::version_string(); |
1276 | 1192 | } |
1277 | 1193 | } |
@@ -1284,8 +1200,7 @@ discard block |
||
1284 | 1200 | * @throws SodiumException |
1285 | 1201 | * @throws TypeError |
1286 | 1202 | */ |
1287 | - function sodium_memcmp($a, $b) |
|
1288 | - { |
|
1203 | + function sodium_memcmp($a, $b) { |
|
1289 | 1204 | return ParagonIE_Sodium_Compat::memcmp($a, $b); |
1290 | 1205 | } |
1291 | 1206 | } |
@@ -1297,8 +1212,7 @@ discard block |
||
1297 | 1212 | * @throws SodiumException |
1298 | 1213 | * @throws TypeError |
1299 | 1214 | */ |
1300 | - function sodium_memzero(&$str) |
|
1301 | - { |
|
1215 | + function sodium_memzero(&$str) { |
|
1302 | 1216 | ParagonIE_Sodium_Compat::memzero($str); |
1303 | 1217 | } |
1304 | 1218 | } |
@@ -1311,8 +1225,7 @@ discard block |
||
1311 | 1225 | * @throws SodiumException |
1312 | 1226 | * @throws TypeError |
1313 | 1227 | */ |
1314 | - function sodium_pad($unpadded, $blockSize) |
|
1315 | - { |
|
1228 | + function sodium_pad($unpadded, $blockSize) { |
|
1316 | 1229 | return ParagonIE_Sodium_Compat::pad($unpadded, $blockSize, true); |
1317 | 1230 | } |
1318 | 1231 | } |
@@ -1325,8 +1238,7 @@ discard block |
||
1325 | 1238 | * @throws SodiumException |
1326 | 1239 | * @throws TypeError |
1327 | 1240 | */ |
1328 | - function sodium_unpad($padded, $blockSize) |
|
1329 | - { |
|
1241 | + function sodium_unpad($padded, $blockSize) { |
|
1330 | 1242 | return ParagonIE_Sodium_Compat::unpad($padded, $blockSize, true); |
1331 | 1243 | } |
1332 | 1244 | } |
@@ -1337,8 +1249,7 @@ discard block |
||
1337 | 1249 | * @return string |
1338 | 1250 | * @throws Exception |
1339 | 1251 | */ |
1340 | - function sodium_randombytes_buf($amount) |
|
1341 | - { |
|
1252 | + function sodium_randombytes_buf($amount) { |
|
1342 | 1253 | return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
1343 | 1254 | } |
1344 | 1255 | } |
@@ -1350,8 +1261,7 @@ discard block |
||
1350 | 1261 | * @return int |
1351 | 1262 | * @throws Exception |
1352 | 1263 | */ |
1353 | - function sodium_randombytes_uniform($upperLimit) |
|
1354 | - { |
|
1264 | + function sodium_randombytes_uniform($upperLimit) { |
|
1355 | 1265 | return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
1356 | 1266 | } |
1357 | 1267 | } |
@@ -1362,8 +1272,7 @@ discard block |
||
1362 | 1272 | * @return int |
1363 | 1273 | * @throws Exception |
1364 | 1274 | */ |
1365 | - function sodium_randombytes_random16() |
|
1366 | - { |
|
1275 | + function sodium_randombytes_random16() { |
|
1367 | 1276 | return ParagonIE_Sodium_Compat::randombytes_random16(); |
1368 | 1277 | } |
1369 | 1278 | } |
@@ -9,8 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @return bool Stop autoloading? |
11 | 11 | */ |
12 | - function sodiumCompatAutoloader($class) |
|
13 | - { |
|
12 | + function sodiumCompatAutoloader($class) { |
|
14 | 13 | $namespace = 'ParagonIE_Sodium_'; |
15 | 14 | // Does the class use the namespace prefix? |
16 | 15 | $len = strlen($namespace); |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | * If you are using this library, you should be using |
13 | 13 | * ParagonIE_Sodium_Compat in your code, not this class. |
14 | 14 | */ |
15 | -abstract class ParagonIE_Sodium_Crypto |
|
16 | -{ |
|
15 | +abstract class ParagonIE_Sodium_Crypto { |
|
17 | 16 | const aead_chacha20poly1305_KEYBYTES = 32; |
18 | 17 | const aead_chacha20poly1305_NSECBYTES = 0; |
19 | 18 | const aead_chacha20poly1305_NPUBBYTES = 8; |
@@ -381,8 +380,7 @@ discard block |
||
381 | 380 | * @return string |
382 | 381 | * @throws TypeError |
383 | 382 | */ |
384 | - public static function auth($message, $key) |
|
385 | - { |
|
383 | + public static function auth($message, $key) { |
|
386 | 384 | return ParagonIE_Sodium_Core_Util::substr( |
387 | 385 | hash_hmac('sha512', $message, $key, true), |
388 | 386 | 0, |
@@ -402,8 +400,7 @@ discard block |
||
402 | 400 | * @throws SodiumException |
403 | 401 | * @throws TypeError |
404 | 402 | */ |
405 | - public static function auth_verify($mac, $message, $key) |
|
406 | - { |
|
403 | + public static function auth_verify($mac, $message, $key) { |
|
407 | 404 | return ParagonIE_Sodium_Core_Util::hashEquals( |
408 | 405 | $mac, |
409 | 406 | self::auth($message, $key) |
@@ -422,8 +419,7 @@ discard block |
||
422 | 419 | * @throws SodiumException |
423 | 420 | * @throws TypeError |
424 | 421 | */ |
425 | - public static function box($plaintext, $nonce, $keypair) |
|
426 | - { |
|
422 | + public static function box($plaintext, $nonce, $keypair) { |
|
427 | 423 | $c = self::secretbox( |
428 | 424 | $plaintext, |
429 | 425 | $nonce, |
@@ -446,8 +442,7 @@ discard block |
||
446 | 442 | * @throws SodiumException |
447 | 443 | * @throws TypeError |
448 | 444 | */ |
449 | - public static function box_seal($message, $publicKey) |
|
450 | - { |
|
445 | + public static function box_seal($message, $publicKey) { |
|
451 | 446 | /** @var string $ephemeralKeypair */ |
452 | 447 | $ephemeralKeypair = self::box_keypair(); |
453 | 448 | |
@@ -492,8 +487,7 @@ discard block |
||
492 | 487 | * @throws SodiumException |
493 | 488 | * @throws TypeError |
494 | 489 | */ |
495 | - public static function box_seal_open($message, $keypair) |
|
496 | - { |
|
490 | + public static function box_seal_open($message, $keypair) { |
|
497 | 491 | /** @var string $ephemeralPK */ |
498 | 492 | $ephemeralPK = ParagonIE_Sodium_Core_Util::substr($message, 0, 32); |
499 | 493 | |
@@ -541,8 +535,7 @@ discard block |
||
541 | 535 | * @throws SodiumException |
542 | 536 | * @throws TypeError |
543 | 537 | */ |
544 | - public static function box_beforenm($sk, $pk) |
|
545 | - { |
|
538 | + public static function box_beforenm($sk, $pk) { |
|
546 | 539 | return ParagonIE_Sodium_Core_HSalsa20::hsalsa20( |
547 | 540 | str_repeat("\x00", 16), |
548 | 541 | self::scalarmult($sk, $pk) |
@@ -557,8 +550,7 @@ discard block |
||
557 | 550 | * @throws SodiumException |
558 | 551 | * @throws TypeError |
559 | 552 | */ |
560 | - public static function box_keypair() |
|
561 | - { |
|
553 | + public static function box_keypair() { |
|
562 | 554 | $sKey = random_bytes(32); |
563 | 555 | $pKey = self::scalarmult_base($sKey); |
564 | 556 | return $sKey . $pKey; |
@@ -570,8 +562,7 @@ discard block |
||
570 | 562 | * @throws SodiumException |
571 | 563 | * @throws TypeError |
572 | 564 | */ |
573 | - public static function box_seed_keypair($seed) |
|
574 | - { |
|
565 | + public static function box_seed_keypair($seed) { |
|
575 | 566 | $sKey = ParagonIE_Sodium_Core_Util::substr( |
576 | 567 | hash('sha512', $seed, true), |
577 | 568 | 0, |
@@ -589,8 +580,7 @@ discard block |
||
589 | 580 | * @return string |
590 | 581 | * @throws TypeError |
591 | 582 | */ |
592 | - public static function box_keypair_from_secretkey_and_publickey($sKey, $pKey) |
|
593 | - { |
|
583 | + public static function box_keypair_from_secretkey_and_publickey($sKey, $pKey) { |
|
594 | 584 | return ParagonIE_Sodium_Core_Util::substr($sKey, 0, 32) . |
595 | 585 | ParagonIE_Sodium_Core_Util::substr($pKey, 0, 32); |
596 | 586 | } |
@@ -603,8 +593,7 @@ discard block |
||
603 | 593 | * @throws RangeException |
604 | 594 | * @throws TypeError |
605 | 595 | */ |
606 | - public static function box_secretkey($keypair) |
|
607 | - { |
|
596 | + public static function box_secretkey($keypair) { |
|
608 | 597 | if (ParagonIE_Sodium_Core_Util::strlen($keypair) !== 64) { |
609 | 598 | throw new RangeException( |
610 | 599 | 'Must be ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES bytes long.' |
@@ -621,8 +610,7 @@ discard block |
||
621 | 610 | * @throws RangeException |
622 | 611 | * @throws TypeError |
623 | 612 | */ |
624 | - public static function box_publickey($keypair) |
|
625 | - { |
|
613 | + public static function box_publickey($keypair) { |
|
626 | 614 | if (ParagonIE_Sodium_Core_Util::strlen($keypair) !== ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES) { |
627 | 615 | throw new RangeException( |
628 | 616 | 'Must be ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES bytes long.' |
@@ -640,8 +628,7 @@ discard block |
||
640 | 628 | * @throws SodiumException |
641 | 629 | * @throws TypeError |
642 | 630 | */ |
643 | - public static function box_publickey_from_secretkey($sKey) |
|
644 | - { |
|
631 | + public static function box_publickey_from_secretkey($sKey) { |
|
645 | 632 | if (ParagonIE_Sodium_Core_Util::strlen($sKey) !== ParagonIE_Sodium_Compat::CRYPTO_BOX_SECRETKEYBYTES) { |
646 | 633 | throw new RangeException( |
647 | 634 | 'Must be ParagonIE_Sodium_Compat::CRYPTO_BOX_SECRETKEYBYTES bytes long.' |
@@ -662,8 +649,7 @@ discard block |
||
662 | 649 | * @throws SodiumException |
663 | 650 | * @throws TypeError |
664 | 651 | */ |
665 | - public static function box_open($ciphertext, $nonce, $keypair) |
|
666 | - { |
|
652 | + public static function box_open($ciphertext, $nonce, $keypair) { |
|
667 | 653 | return self::secretbox_open( |
668 | 654 | $ciphertext, |
669 | 655 | $nonce, |
@@ -687,8 +673,7 @@ discard block |
||
687 | 673 | * @throws SodiumException |
688 | 674 | * @throws TypeError |
689 | 675 | */ |
690 | - public static function generichash($message, $key = '', $outlen = 32) |
|
691 | - { |
|
676 | + public static function generichash($message, $key = '', $outlen = 32) { |
|
692 | 677 | // This ensures that ParagonIE_Sodium_Core_BLAKE2b::$iv is initialized |
693 | 678 | ParagonIE_Sodium_Core_BLAKE2b::pseudoConstructor(); |
694 | 679 | |
@@ -728,8 +713,7 @@ discard block |
||
728 | 713 | * @throws SodiumException |
729 | 714 | * @throws TypeError |
730 | 715 | */ |
731 | - public static function generichash_final($ctx, $outlen = 32) |
|
732 | - { |
|
716 | + public static function generichash_final($ctx, $outlen = 32) { |
|
733 | 717 | if (!is_string($ctx)) { |
734 | 718 | throw new TypeError('Context must be a string'); |
735 | 719 | } |
@@ -758,8 +742,7 @@ discard block |
||
758 | 742 | * @throws SodiumException |
759 | 743 | * @throws TypeError |
760 | 744 | */ |
761 | - public static function generichash_init($key = '', $outputLength = 32) |
|
762 | - { |
|
745 | + public static function generichash_init($key = '', $outputLength = 32) { |
|
763 | 746 | // This ensures that ParagonIE_Sodium_Core_BLAKE2b::$iv is initialized |
764 | 747 | ParagonIE_Sodium_Core_BLAKE2b::pseudoConstructor(); |
765 | 748 | |
@@ -835,8 +818,7 @@ discard block |
||
835 | 818 | * @throws SodiumException |
836 | 819 | * @throws TypeError |
837 | 820 | */ |
838 | - public static function generichash_update($ctx, $message) |
|
839 | - { |
|
821 | + public static function generichash_update($ctx, $message) { |
|
840 | 822 | // This ensures that ParagonIE_Sodium_Core_BLAKE2b::$iv is initialized |
841 | 823 | ParagonIE_Sodium_Core_BLAKE2b::pseudoConstructor(); |
842 | 824 | |
@@ -864,8 +846,7 @@ discard block |
||
864 | 846 | * @throws SodiumException |
865 | 847 | * @throws TypeError |
866 | 848 | */ |
867 | - public static function keyExchange($my_sk, $their_pk, $client_pk, $server_pk) |
|
868 | - { |
|
849 | + public static function keyExchange($my_sk, $their_pk, $client_pk, $server_pk) { |
|
869 | 850 | return ParagonIE_Sodium_Compat::crypto_generichash( |
870 | 851 | ParagonIE_Sodium_Compat::crypto_scalarmult($my_sk, $their_pk) . |
871 | 852 | $client_pk . |
@@ -885,8 +866,7 @@ discard block |
||
885 | 866 | * @throws SodiumException |
886 | 867 | * @throws TypeError |
887 | 868 | */ |
888 | - public static function scalarmult($sKey, $pKey) |
|
889 | - { |
|
869 | + public static function scalarmult($sKey, $pKey) { |
|
890 | 870 | $q = ParagonIE_Sodium_Core_X25519::crypto_scalarmult_curve25519_ref10($sKey, $pKey); |
891 | 871 | self::scalarmult_throw_if_zero($q); |
892 | 872 | return $q; |
@@ -902,8 +882,7 @@ discard block |
||
902 | 882 | * @throws SodiumException |
903 | 883 | * @throws TypeError |
904 | 884 | */ |
905 | - public static function scalarmult_base($secret) |
|
906 | - { |
|
885 | + public static function scalarmult_base($secret) { |
|
907 | 886 | $q = ParagonIE_Sodium_Core_X25519::crypto_scalarmult_curve25519_ref10_base($secret); |
908 | 887 | self::scalarmult_throw_if_zero($q); |
909 | 888 | return $q; |
@@ -917,8 +896,7 @@ discard block |
||
917 | 896 | * @throws SodiumException |
918 | 897 | * @throws TypeError |
919 | 898 | */ |
920 | - protected static function scalarmult_throw_if_zero($q) |
|
921 | - { |
|
899 | + protected static function scalarmult_throw_if_zero($q) { |
|
922 | 900 | $d = 0; |
923 | 901 | for ($i = 0; $i < self::box_curve25519xsalsa20poly1305_SECRETKEYBYTES; ++$i) { |
924 | 902 | $d |= ParagonIE_Sodium_Core_Util::chrToInt($q[$i]); |
@@ -942,8 +920,7 @@ discard block |
||
942 | 920 | * @throws SodiumException |
943 | 921 | * @throws TypeError |
944 | 922 | */ |
945 | - public static function secretbox($plaintext, $nonce, $key) |
|
946 | - { |
|
923 | + public static function secretbox($plaintext, $nonce, $key) { |
|
947 | 924 | /** @var string $subkey */ |
948 | 925 | $subkey = ParagonIE_Sodium_Core_HSalsa20::hsalsa20($nonce, $key); |
949 | 926 | |
@@ -1017,8 +994,7 @@ discard block |
||
1017 | 994 | * @throws SodiumException |
1018 | 995 | * @throws TypeError |
1019 | 996 | */ |
1020 | - public static function secretbox_open($ciphertext, $nonce, $key) |
|
1021 | - { |
|
997 | + public static function secretbox_open($ciphertext, $nonce, $key) { |
|
1022 | 998 | /** @var string $mac */ |
1023 | 999 | $mac = ParagonIE_Sodium_Core_Util::substr( |
1024 | 1000 | $ciphertext, |
@@ -1090,8 +1066,7 @@ discard block |
||
1090 | 1066 | * @throws SodiumException |
1091 | 1067 | * @throws TypeError |
1092 | 1068 | */ |
1093 | - public static function secretbox_xchacha20poly1305($plaintext, $nonce, $key) |
|
1094 | - { |
|
1069 | + public static function secretbox_xchacha20poly1305($plaintext, $nonce, $key) { |
|
1095 | 1070 | /** @var string $subkey */ |
1096 | 1071 | $subkey = ParagonIE_Sodium_Core_HChaCha20::hChaCha20( |
1097 | 1072 | ParagonIE_Sodium_Core_Util::substr($nonce, 0, 16), |
@@ -1169,8 +1144,7 @@ discard block |
||
1169 | 1144 | * @throws SodiumException |
1170 | 1145 | * @throws TypeError |
1171 | 1146 | */ |
1172 | - public static function secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key) |
|
1173 | - { |
|
1147 | + public static function secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key) { |
|
1174 | 1148 | /** @var string $mac */ |
1175 | 1149 | $mac = ParagonIE_Sodium_Core_Util::substr( |
1176 | 1150 | $ciphertext, |
@@ -1238,8 +1212,7 @@ discard block |
||
1238 | 1212 | * @throws Exception |
1239 | 1213 | * @throws SodiumException |
1240 | 1214 | */ |
1241 | - public static function secretstream_xchacha20poly1305_init_push($key) |
|
1242 | - { |
|
1215 | + public static function secretstream_xchacha20poly1305_init_push($key) { |
|
1243 | 1216 | # randombytes_buf(out, crypto_secretstream_xchacha20poly1305_HEADERBYTES); |
1244 | 1217 | $out = random_bytes(24); |
1245 | 1218 | |
@@ -1268,8 +1241,7 @@ discard block |
||
1268 | 1241 | * @return string Returns a state. |
1269 | 1242 | * @throws Exception |
1270 | 1243 | */ |
1271 | - public static function secretstream_xchacha20poly1305_init_pull($key, $header) |
|
1272 | - { |
|
1244 | + public static function secretstream_xchacha20poly1305_init_pull($key, $header) { |
|
1273 | 1245 | # crypto_core_hchacha20(state->k, in, k, NULL); |
1274 | 1246 | $subkey = ParagonIE_Sodium_Core_HChaCha20::hChaCha20( |
1275 | 1247 | ParagonIE_Sodium_Core_Util::substr($header, 0, 16), |
@@ -1295,8 +1267,7 @@ discard block |
||
1295 | 1267 | * @return string |
1296 | 1268 | * @throws SodiumException |
1297 | 1269 | */ |
1298 | - public static function secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) |
|
1299 | - { |
|
1270 | + public static function secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) { |
|
1300 | 1271 | $st = ParagonIE_Sodium_Core_SecretStream_State::fromString($state); |
1301 | 1272 | # crypto_onetimeauth_poly1305_state poly1305_state; |
1302 | 1273 | # unsigned char block[64U]; |
@@ -1424,8 +1395,7 @@ discard block |
||
1424 | 1395 | * @return bool|array{0: string, 1: int} |
1425 | 1396 | * @throws SodiumException |
1426 | 1397 | */ |
1427 | - public static function secretstream_xchacha20poly1305_pull(&$state, $cipher, $aad = '') |
|
1428 | - { |
|
1398 | + public static function secretstream_xchacha20poly1305_pull(&$state, $cipher, $aad = '') { |
|
1429 | 1399 | $st = ParagonIE_Sodium_Core_SecretStream_State::fromString($state); |
1430 | 1400 | |
1431 | 1401 | $cipherlen = ParagonIE_Sodium_Core_Util::strlen($cipher); |
@@ -1547,8 +1517,7 @@ discard block |
||
1547 | 1517 | * @return void |
1548 | 1518 | * @throws SodiumException |
1549 | 1519 | */ |
1550 | - public static function secretstream_xchacha20poly1305_rekey(&$state) |
|
1551 | - { |
|
1520 | + public static function secretstream_xchacha20poly1305_rekey(&$state) { |
|
1552 | 1521 | $st = ParagonIE_Sodium_Core_SecretStream_State::fromString($state); |
1553 | 1522 | # unsigned char new_key_and_inonce[crypto_stream_chacha20_ietf_KEYBYTES + |
1554 | 1523 | # crypto_secretstream_xchacha20poly1305_INONCEBYTES]; |
@@ -1599,8 +1568,7 @@ discard block |
||
1599 | 1568 | * @throws SodiumException |
1600 | 1569 | * @throws TypeError |
1601 | 1570 | */ |
1602 | - public static function sign_detached($message, $sk) |
|
1603 | - { |
|
1571 | + public static function sign_detached($message, $sk) { |
|
1604 | 1572 | return ParagonIE_Sodium_Core_Ed25519::sign_detached($message, $sk); |
1605 | 1573 | } |
1606 | 1574 | |
@@ -1615,8 +1583,7 @@ discard block |
||
1615 | 1583 | * @throws SodiumException |
1616 | 1584 | * @throws TypeError |
1617 | 1585 | */ |
1618 | - public static function sign($message, $sk) |
|
1619 | - { |
|
1586 | + public static function sign($message, $sk) { |
|
1620 | 1587 | return ParagonIE_Sodium_Core_Ed25519::sign($message, $sk); |
1621 | 1588 | } |
1622 | 1589 | |
@@ -1631,8 +1598,7 @@ discard block |
||
1631 | 1598 | * @throws SodiumException |
1632 | 1599 | * @throws TypeError |
1633 | 1600 | */ |
1634 | - public static function sign_open($signedMessage, $pk) |
|
1635 | - { |
|
1601 | + public static function sign_open($signedMessage, $pk) { |
|
1636 | 1602 | return ParagonIE_Sodium_Core_Ed25519::sign_open($signedMessage, $pk); |
1637 | 1603 | } |
1638 | 1604 | |
@@ -1648,8 +1614,7 @@ discard block |
||
1648 | 1614 | * @throws SodiumException |
1649 | 1615 | * @throws TypeError |
1650 | 1616 | */ |
1651 | - public static function sign_verify_detached($signature, $message, $pk) |
|
1652 | - { |
|
1617 | + public static function sign_verify_detached($signature, $message, $pk) { |
|
1653 | 1618 | return ParagonIE_Sodium_Core_Ed25519::verify_detached($signature, $message, $pk); |
1654 | 1619 | } |
1655 | 1620 | } |