@@ -45,8 +45,7 @@ |
||
45 | 45 | * |
46 | 46 | * @return string |
47 | 47 | */ |
48 | - function random_bytes($bytes) |
|
49 | - { |
|
48 | + function random_bytes($bytes) { |
|
50 | 49 | /** @var resource $fp */ |
51 | 50 | static $fp = null; |
52 | 51 |
@@ -38,8 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | * @return int |
40 | 40 | */ |
41 | - function random_int($min, $max) |
|
42 | - { |
|
41 | + function random_int($min, $max) { |
|
43 | 42 | /** |
44 | 43 | * Type and input logic checks |
45 | 44 | * |
@@ -40,8 +40,7 @@ |
||
40 | 40 | * |
41 | 41 | * @return string |
42 | 42 | */ |
43 | - function random_bytes($bytes) |
|
44 | - { |
|
43 | + function random_bytes($bytes) { |
|
45 | 44 | try { |
46 | 45 | /** @var int $bytes */ |
47 | 46 | $bytes = RandomCompat_intval($bytes); |
@@ -45,8 +45,7 @@ |
||
45 | 45 | * |
46 | 46 | * @throws TypeError |
47 | 47 | */ |
48 | - function RandomCompat_intval($number, $fail_open = false) |
|
49 | - { |
|
48 | + function RandomCompat_intval($number, $fail_open = false) { |
|
50 | 49 | if (is_int($number) || is_float($number)) { |
51 | 50 | $number += 0; |
52 | 51 | } elseif (is_numeric($number)) { |
@@ -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 |