@@ -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 | } |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | /** |
| 7 | 7 | * Class ParagonIE_Sodium_File |
| 8 | 8 | */ |
| 9 | -class ParagonIE_Sodium_File extends ParagonIE_Sodium_Core_Util |
|
| 10 | -{ |
|
| 9 | +class ParagonIE_Sodium_File extends ParagonIE_Sodium_Core_Util { |
|
| 11 | 10 | /* PHP's default buffer size is 8192 for fread()/fwrite(). */ |
| 12 | 11 | const BUFFER_SIZE = 8192; |
| 13 | 12 | |
@@ -25,8 +24,7 @@ discard block |
||
| 25 | 24 | * @throws SodiumException |
| 26 | 25 | * @throws TypeError |
| 27 | 26 | */ |
| 28 | - public static function box($inputFile, $outputFile, $nonce, $keyPair) |
|
| 29 | - { |
|
| 27 | + public static function box($inputFile, $outputFile, $nonce, $keyPair) { |
|
| 30 | 28 | /* Type checks: */ |
| 31 | 29 | if (!is_string($inputFile)) { |
| 32 | 30 | throw new TypeError('Argument 1 must be a string, ' . gettype($inputFile) . ' given.'); |
@@ -91,8 +89,7 @@ discard block |
||
| 91 | 89 | * @throws SodiumException |
| 92 | 90 | * @throws TypeError |
| 93 | 91 | */ |
| 94 | - public static function box_open($inputFile, $outputFile, $nonce, $keypair) |
|
| 95 | - { |
|
| 92 | + public static function box_open($inputFile, $outputFile, $nonce, $keypair) { |
|
| 96 | 93 | /* Type checks: */ |
| 97 | 94 | if (!is_string($inputFile)) { |
| 98 | 95 | throw new TypeError('Argument 1 must be a string, ' . gettype($inputFile) . ' given.'); |
@@ -161,8 +158,7 @@ discard block |
||
| 161 | 158 | * @throws SodiumException |
| 162 | 159 | * @throws TypeError |
| 163 | 160 | */ |
| 164 | - public static function box_seal($inputFile, $outputFile, $publicKey) |
|
| 165 | - { |
|
| 161 | + public static function box_seal($inputFile, $outputFile, $publicKey) { |
|
| 166 | 162 | /* Type checks: */ |
| 167 | 163 | if (!is_string($inputFile)) { |
| 168 | 164 | throw new TypeError('Argument 1 must be a string, ' . gettype($inputFile) . ' given.'); |
@@ -265,8 +261,7 @@ discard block |
||
| 265 | 261 | * @throws SodiumException |
| 266 | 262 | * @throws TypeError |
| 267 | 263 | */ |
| 268 | - public static function box_seal_open($inputFile, $outputFile, $ecdhKeypair) |
|
| 269 | - { |
|
| 264 | + public static function box_seal_open($inputFile, $outputFile, $ecdhKeypair) { |
|
| 270 | 265 | /* Type checks: */ |
| 271 | 266 | if (!is_string($inputFile)) { |
| 272 | 267 | throw new TypeError('Argument 1 must be a string, ' . gettype($inputFile) . ' given.'); |
@@ -350,8 +345,7 @@ discard block |
||
| 350 | 345 | * @throws TypeError |
| 351 | 346 | * @psalm-suppress FailedTypeResolution |
| 352 | 347 | */ |
| 353 | - public static function generichash($filePath, $key = '', $outputLength = 32) |
|
| 354 | - { |
|
| 348 | + public static function generichash($filePath, $key = '', $outputLength = 32) { |
|
| 355 | 349 | /* Type checks: */ |
| 356 | 350 | if (!is_string($filePath)) { |
| 357 | 351 | throw new TypeError('Argument 1 must be a string, ' . gettype($filePath) . ' given.'); |
@@ -428,8 +422,7 @@ discard block |
||
| 428 | 422 | * @throws SodiumException |
| 429 | 423 | * @throws TypeError |
| 430 | 424 | */ |
| 431 | - public static function secretbox($inputFile, $outputFile, $nonce, $key) |
|
| 432 | - { |
|
| 425 | + public static function secretbox($inputFile, $outputFile, $nonce, $key) { |
|
| 433 | 426 | /* Type checks: */ |
| 434 | 427 | if (!is_string($inputFile)) { |
| 435 | 428 | throw new TypeError('Argument 1 must be a string, ' . gettype($inputFile) . ' given..'); |
@@ -493,8 +486,7 @@ discard block |
||
| 493 | 486 | * @throws SodiumException |
| 494 | 487 | * @throws TypeError |
| 495 | 488 | */ |
| 496 | - public static function secretbox_open($inputFile, $outputFile, $nonce, $key) |
|
| 497 | - { |
|
| 489 | + public static function secretbox_open($inputFile, $outputFile, $nonce, $key) { |
|
| 498 | 490 | /* Type checks: */ |
| 499 | 491 | if (!is_string($inputFile)) { |
| 500 | 492 | throw new TypeError('Argument 1 must be a string, ' . gettype($inputFile) . ' given.'); |
@@ -560,8 +552,7 @@ discard block |
||
| 560 | 552 | * @throws SodiumException |
| 561 | 553 | * @throws TypeError |
| 562 | 554 | */ |
| 563 | - public static function sign($filePath, $secretKey) |
|
| 564 | - { |
|
| 555 | + public static function sign($filePath, $secretKey) { |
|
| 565 | 556 | /* Type checks: */ |
| 566 | 557 | if (!is_string($filePath)) { |
| 567 | 558 | throw new TypeError('Argument 1 must be a string, ' . gettype($filePath) . ' given.'); |
@@ -656,8 +647,7 @@ discard block |
||
| 656 | 647 | * @throws TypeError |
| 657 | 648 | * @throws Exception |
| 658 | 649 | */ |
| 659 | - public static function verify($sig, $filePath, $publicKey) |
|
| 660 | - { |
|
| 650 | + public static function verify($sig, $filePath, $publicKey) { |
|
| 661 | 651 | /* Type checks: */ |
| 662 | 652 | if (!is_string($sig)) { |
| 663 | 653 | throw new TypeError('Argument 1 must be a string, ' . gettype($sig) . ' given.'); |
@@ -766,8 +756,7 @@ discard block |
||
| 766 | 756 | * @throws SodiumException |
| 767 | 757 | * @throws TypeError |
| 768 | 758 | */ |
| 769 | - protected static function box_encrypt($ifp, $ofp, $mlen, $nonce, $boxKeypair) |
|
| 770 | - { |
|
| 759 | + protected static function box_encrypt($ifp, $ofp, $mlen, $nonce, $boxKeypair) { |
|
| 771 | 760 | if (PHP_INT_SIZE === 4) { |
| 772 | 761 | return self::secretbox_encrypt( |
| 773 | 762 | $ifp, |
@@ -803,8 +792,7 @@ discard block |
||
| 803 | 792 | * @throws SodiumException |
| 804 | 793 | * @throws TypeError |
| 805 | 794 | */ |
| 806 | - protected static function box_decrypt($ifp, $ofp, $mlen, $nonce, $boxKeypair) |
|
| 807 | - { |
|
| 795 | + protected static function box_decrypt($ifp, $ofp, $mlen, $nonce, $boxKeypair) { |
|
| 808 | 796 | if (PHP_INT_SIZE === 4) { |
| 809 | 797 | return self::secretbox_decrypt( |
| 810 | 798 | $ifp, |
@@ -841,8 +829,7 @@ discard block |
||
| 841 | 829 | * @throws SodiumException |
| 842 | 830 | * @throws TypeError |
| 843 | 831 | */ |
| 844 | - protected static function secretbox_encrypt($ifp, $ofp, $mlen, $nonce, $key) |
|
| 845 | - { |
|
| 832 | + protected static function secretbox_encrypt($ifp, $ofp, $mlen, $nonce, $key) { |
|
| 846 | 833 | if (PHP_INT_SIZE === 4) { |
| 847 | 834 | return self::secretbox_encrypt_core32($ifp, $ofp, $mlen, $nonce, $key); |
| 848 | 835 | } |
@@ -962,8 +949,7 @@ discard block |
||
| 962 | 949 | * @throws SodiumException |
| 963 | 950 | * @throws TypeError |
| 964 | 951 | */ |
| 965 | - protected static function secretbox_decrypt($ifp, $ofp, $mlen, $nonce, $key) |
|
| 966 | - { |
|
| 952 | + protected static function secretbox_decrypt($ifp, $ofp, $mlen, $nonce, $key) { |
|
| 967 | 953 | if (PHP_INT_SIZE === 4) { |
| 968 | 954 | return self::secretbox_decrypt_core32($ifp, $ofp, $mlen, $nonce, $key); |
| 969 | 955 | } |
@@ -1095,8 +1081,7 @@ discard block |
||
| 1095 | 1081 | * @psalm-suppress TypeCoercion |
| 1096 | 1082 | * Ditto. |
| 1097 | 1083 | */ |
| 1098 | - public static function updateHashWithFile($hash, $fp, $size = 0) |
|
| 1099 | - { |
|
| 1084 | + public static function updateHashWithFile($hash, $fp, $size = 0) { |
|
| 1100 | 1085 | /* Type checks: */ |
| 1101 | 1086 | if (PHP_VERSION_ID < 70200) { |
| 1102 | 1087 | if (!is_resource($hash)) { |
@@ -1152,8 +1137,7 @@ discard block |
||
| 1152 | 1137 | * @throws SodiumException |
| 1153 | 1138 | * @throws TypeError |
| 1154 | 1139 | */ |
| 1155 | - private static function sign_core32($filePath, $secretKey) |
|
| 1156 | - { |
|
| 1140 | + private static function sign_core32($filePath, $secretKey) { |
|
| 1157 | 1141 | /** @var int|bool $size */ |
| 1158 | 1142 | $size = filesize($filePath); |
| 1159 | 1143 | if (!is_int($size)) { |
@@ -1234,8 +1218,7 @@ discard block |
||
| 1234 | 1218 | * @throws SodiumException |
| 1235 | 1219 | * @throws Exception |
| 1236 | 1220 | */ |
| 1237 | - public static function verify_core32($sig, $filePath, $publicKey) |
|
| 1238 | - { |
|
| 1221 | + public static function verify_core32($sig, $filePath, $publicKey) { |
|
| 1239 | 1222 | /* Security checks */ |
| 1240 | 1223 | if (ParagonIE_Sodium_Core32_Ed25519::check_S_lt_L(self::substr($sig, 32, 32))) { |
| 1241 | 1224 | throw new SodiumException('S < L - Invalid signature'); |
@@ -1318,8 +1301,7 @@ discard block |
||
| 1318 | 1301 | * @throws SodiumException |
| 1319 | 1302 | * @throws TypeError |
| 1320 | 1303 | */ |
| 1321 | - protected static function secretbox_encrypt_core32($ifp, $ofp, $mlen, $nonce, $key) |
|
| 1322 | - { |
|
| 1304 | + protected static function secretbox_encrypt_core32($ifp, $ofp, $mlen, $nonce, $key) { |
|
| 1323 | 1305 | $plaintext = fread($ifp, 32); |
| 1324 | 1306 | if (!is_string($plaintext)) { |
| 1325 | 1307 | throw new SodiumException('Could not read input file'); |
@@ -1435,8 +1417,7 @@ discard block |
||
| 1435 | 1417 | * @throws SodiumException |
| 1436 | 1418 | * @throws TypeError |
| 1437 | 1419 | */ |
| 1438 | - protected static function secretbox_decrypt_core32($ifp, $ofp, $mlen, $nonce, $key) |
|
| 1439 | - { |
|
| 1420 | + protected static function secretbox_decrypt_core32($ifp, $ofp, $mlen, $nonce, $key) { |
|
| 1440 | 1421 | $tag = fread($ifp, 16); |
| 1441 | 1422 | if (!is_string($tag)) { |
| 1442 | 1423 | throw new SodiumException('Could not read input file'); |
@@ -1549,8 +1530,7 @@ discard block |
||
| 1549 | 1530 | * @return int |
| 1550 | 1531 | * @throws SodiumException |
| 1551 | 1532 | */ |
| 1552 | - private static function ftell($resource) |
|
| 1553 | - { |
|
| 1533 | + private static function ftell($resource) { |
|
| 1554 | 1534 | $return = ftell($resource); |
| 1555 | 1535 | if (!is_int($return)) { |
| 1556 | 1536 | throw new SodiumException('ftell() returned false'); |
@@ -23,8 +23,7 @@ discard block |
||
| 23 | 23 | * SplFixedArray constructor. |
| 24 | 24 | * @param int $size |
| 25 | 25 | */ |
| 26 | - public function __construct($size = 0) |
|
| 27 | - { |
|
| 26 | + public function __construct($size = 0) { |
|
| 28 | 27 | $this->size = $size; |
| 29 | 28 | $this->internalArray = array(); |
| 30 | 29 | } |
@@ -32,16 +31,14 @@ discard block |
||
| 32 | 31 | /** |
| 33 | 32 | * @return int |
| 34 | 33 | */ |
| 35 | - public function count() |
|
| 36 | - { |
|
| 34 | + public function count() { |
|
| 37 | 35 | return count($this->internalArray); |
| 38 | 36 | } |
| 39 | 37 | |
| 40 | 38 | /** |
| 41 | 39 | * @return array |
| 42 | 40 | */ |
| 43 | - public function toArray() |
|
| 44 | - { |
|
| 41 | + public function toArray() { |
|
| 45 | 42 | ksort($this->internalArray); |
| 46 | 43 | return (array) $this->internalArray; |
| 47 | 44 | } |
@@ -52,8 +49,7 @@ discard block |
||
| 52 | 49 | * @return SplFixedArray |
| 53 | 50 | * @psalm-suppress MixedAssignment |
| 54 | 51 | */ |
| 55 | - public static function fromArray(array $array, $save_indexes = true) |
|
| 56 | - { |
|
| 52 | + public static function fromArray(array $array, $save_indexes = true) { |
|
| 57 | 53 | $self = new SplFixedArray(count($array)); |
| 58 | 54 | if($save_indexes) { |
| 59 | 55 | foreach($array as $key => $value) { |
@@ -72,8 +68,7 @@ discard block |
||
| 72 | 68 | /** |
| 73 | 69 | * @return int |
| 74 | 70 | */ |
| 75 | - public function getSize() |
|
| 76 | - { |
|
| 71 | + public function getSize() { |
|
| 77 | 72 | return $this->size; |
| 78 | 73 | } |
| 79 | 74 | |
@@ -81,8 +76,7 @@ discard block |
||
| 81 | 76 | * @param int $size |
| 82 | 77 | * @return bool |
| 83 | 78 | */ |
| 84 | - public function setSize($size) |
|
| 85 | - { |
|
| 79 | + public function setSize($size) { |
|
| 86 | 80 | $this->size = $size; |
| 87 | 81 | return true; |
| 88 | 82 | } |
@@ -91,8 +85,7 @@ discard block |
||
| 91 | 85 | * @param string|int $index |
| 92 | 86 | * @return bool |
| 93 | 87 | */ |
| 94 | - public function offsetExists($index) |
|
| 95 | - { |
|
| 88 | + public function offsetExists($index) { |
|
| 96 | 89 | return array_key_exists((int) $index, $this->internalArray); |
| 97 | 90 | } |
| 98 | 91 | |
@@ -100,8 +93,7 @@ discard block |
||
| 100 | 93 | * @param string|int $index |
| 101 | 94 | * @return mixed |
| 102 | 95 | */ |
| 103 | - public function offsetGet($index) |
|
| 104 | - { |
|
| 96 | + public function offsetGet($index) { |
|
| 105 | 97 | /** @psalm-suppress MixedReturnStatement */ |
| 106 | 98 | return $this->internalArray[(int) $index]; |
| 107 | 99 | } |
@@ -111,16 +103,14 @@ discard block |
||
| 111 | 103 | * @param mixed $newval |
| 112 | 104 | * @psalm-suppress MixedAssignment |
| 113 | 105 | */ |
| 114 | - public function offsetSet($index, $newval) |
|
| 115 | - { |
|
| 106 | + public function offsetSet($index, $newval) { |
|
| 116 | 107 | $this->internalArray[(int) $index] = $newval; |
| 117 | 108 | } |
| 118 | 109 | |
| 119 | 110 | /** |
| 120 | 111 | * @param string|int $index |
| 121 | 112 | */ |
| 122 | - public function offsetUnset($index) |
|
| 123 | - { |
|
| 113 | + public function offsetUnset($index) { |
|
| 124 | 114 | unset($this->internalArray[(int) $index]); |
| 125 | 115 | } |
| 126 | 116 | |
@@ -130,8 +120,7 @@ discard block |
||
| 130 | 120 | * @return void |
| 131 | 121 | * @since 5.3.0 |
| 132 | 122 | */ |
| 133 | - public function rewind() |
|
| 134 | - { |
|
| 123 | + public function rewind() { |
|
| 135 | 124 | reset($this->internalArray); |
| 136 | 125 | } |
| 137 | 126 | |
@@ -141,8 +130,7 @@ discard block |
||
| 141 | 130 | * @return mixed The current element value. |
| 142 | 131 | * @since 5.3.0 |
| 143 | 132 | */ |
| 144 | - public function current() |
|
| 145 | - { |
|
| 133 | + public function current() { |
|
| 146 | 134 | /** @psalm-suppress MixedReturnStatement */ |
| 147 | 135 | return current($this->internalArray); |
| 148 | 136 | } |
@@ -151,16 +139,14 @@ discard block |
||
| 151 | 139 | * Return current array index |
| 152 | 140 | * @return int The current array index. |
| 153 | 141 | */ |
| 154 | - public function key() |
|
| 155 | - { |
|
| 142 | + public function key() { |
|
| 156 | 143 | return key($this->internalArray); |
| 157 | 144 | } |
| 158 | 145 | |
| 159 | 146 | /** |
| 160 | 147 | * @return void |
| 161 | 148 | */ |
| 162 | - public function next() |
|
| 163 | - { |
|
| 149 | + public function next() { |
|
| 164 | 150 | next($this->internalArray); |
| 165 | 151 | } |
| 166 | 152 | |
@@ -169,8 +155,7 @@ discard block |
||
| 169 | 155 | * @link https://php.net/manual/en/splfixedarray.valid.php |
| 170 | 156 | * @return bool true if the array contains any more elements, false otherwise. |
| 171 | 157 | */ |
| 172 | - public function valid() |
|
| 173 | - { |
|
| 158 | + public function valid() { |
|
| 174 | 159 | if (empty($this->internalArray)) { |
| 175 | 160 | return false; |
| 176 | 161 | } |
@@ -182,8 +167,7 @@ discard block |
||
| 182 | 167 | /** |
| 183 | 168 | * Do nothing. |
| 184 | 169 | */ |
| 185 | - public function __wakeup() |
|
| 186 | - { |
|
| 170 | + public function __wakeup() { |
|
| 187 | 171 | // NOP |
| 188 | 172 | } |
| 189 | 173 | } |
| 190 | 174 | \ No newline at end of file |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -class ParagonIE_Sodium_Compat |
|
| 29 | -{ |
|
| 28 | +class ParagonIE_Sodium_Compat { |
|
| 30 | 29 | /** |
| 31 | 30 | * This parameter prevents the use of the PECL extension. |
| 32 | 31 | * It should only be used for unit testing. |
@@ -155,8 +154,7 @@ discard block |
||
| 155 | 154 | * @return void |
| 156 | 155 | * @throws SodiumException |
| 157 | 156 | */ |
| 158 | - public static function add(&$val, $addv) |
|
| 159 | - { |
|
| 157 | + public static function add(&$val, $addv) { |
|
| 160 | 158 | $val_len = ParagonIE_Sodium_Core_Util::strlen($val); |
| 161 | 159 | $addv_len = ParagonIE_Sodium_Core_Util::strlen($addv); |
| 162 | 160 | if ($val_len !== $addv_len) { |
@@ -181,8 +179,7 @@ discard block |
||
| 181 | 179 | * @return string |
| 182 | 180 | * @throws SodiumException |
| 183 | 181 | */ |
| 184 | - public static function base642bin($encoded, $variant, $ignore = '') |
|
| 185 | - { |
|
| 182 | + public static function base642bin($encoded, $variant, $ignore = '') { |
|
| 186 | 183 | /* Type checks: */ |
| 187 | 184 | ParagonIE_Sodium_Core_Util::declareScalarType($encoded, 'string', 1); |
| 188 | 185 | |
@@ -224,8 +221,7 @@ discard block |
||
| 224 | 221 | * @return string |
| 225 | 222 | * @throws SodiumException |
| 226 | 223 | */ |
| 227 | - public static function bin2base64($decoded, $variant) |
|
| 228 | - { |
|
| 224 | + public static function bin2base64($decoded, $variant) { |
|
| 229 | 225 | /* Type checks: */ |
| 230 | 226 | ParagonIE_Sodium_Core_Util::declareScalarType($decoded, 'string', 1); |
| 231 | 227 | /** @var string $decoded */ |
@@ -257,8 +253,7 @@ discard block |
||
| 257 | 253 | * @throws TypeError |
| 258 | 254 | * @psalm-suppress MixedArgument |
| 259 | 255 | */ |
| 260 | - public static function bin2hex($string) |
|
| 261 | - { |
|
| 256 | + public static function bin2hex($string) { |
|
| 262 | 257 | /* Type checks: */ |
| 263 | 258 | ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1); |
| 264 | 259 | |
@@ -284,8 +279,7 @@ discard block |
||
| 284 | 279 | * @throws TypeError |
| 285 | 280 | * @psalm-suppress MixedArgument |
| 286 | 281 | */ |
| 287 | - public static function compare($left, $right) |
|
| 288 | - { |
|
| 282 | + public static function compare($left, $right) { |
|
| 289 | 283 | /* Type checks: */ |
| 290 | 284 | ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1); |
| 291 | 285 | ParagonIE_Sodium_Core_Util::declareScalarType($right, 'string', 2); |
@@ -307,8 +301,7 @@ discard block |
||
| 307 | 301 | * @psalm-suppress MixedInferredReturnType |
| 308 | 302 | * @psalm-suppress MixedReturnStatement |
| 309 | 303 | */ |
| 310 | - public static function crypto_aead_aes256gcm_is_available() |
|
| 311 | - { |
|
| 304 | + public static function crypto_aead_aes256gcm_is_available() { |
|
| 312 | 305 | if (self::useNewSodiumAPI()) { |
| 313 | 306 | return sodium_crypto_aead_aes256gcm_is_available(); |
| 314 | 307 | } |
@@ -454,8 +447,7 @@ discard block |
||
| 454 | 447 | * @throws Exception |
| 455 | 448 | * @throws Error |
| 456 | 449 | */ |
| 457 | - public static function crypto_aead_aes256gcm_keygen() |
|
| 458 | - { |
|
| 450 | + public static function crypto_aead_aes256gcm_keygen() { |
|
| 459 | 451 | return random_bytes(self::CRYPTO_AEAD_AES256GCM_KEYBYTES); |
| 460 | 452 | } |
| 461 | 453 | |
@@ -702,8 +694,7 @@ discard block |
||
| 702 | 694 | * @throws Exception |
| 703 | 695 | * @throws Error |
| 704 | 696 | */ |
| 705 | - public static function crypto_aead_chacha20poly1305_keygen() |
|
| 706 | - { |
|
| 697 | + public static function crypto_aead_chacha20poly1305_keygen() { |
|
| 707 | 698 | return random_bytes(self::CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES); |
| 708 | 699 | } |
| 709 | 700 | |
@@ -790,8 +781,7 @@ discard block |
||
| 790 | 781 | * @throws Exception |
| 791 | 782 | * @throws Error |
| 792 | 783 | */ |
| 793 | - public static function crypto_aead_chacha20poly1305_ietf_keygen() |
|
| 794 | - { |
|
| 784 | + public static function crypto_aead_chacha20poly1305_ietf_keygen() { |
|
| 795 | 785 | return random_bytes(self::CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES); |
| 796 | 786 | } |
| 797 | 787 | |
@@ -949,8 +939,7 @@ discard block |
||
| 949 | 939 | * @throws Exception |
| 950 | 940 | * @throws Error |
| 951 | 941 | */ |
| 952 | - public static function crypto_aead_xchacha20poly1305_ietf_keygen() |
|
| 953 | - { |
|
| 942 | + public static function crypto_aead_xchacha20poly1305_ietf_keygen() { |
|
| 954 | 943 | return random_bytes(self::CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES); |
| 955 | 944 | } |
| 956 | 945 | |
@@ -971,8 +960,7 @@ discard block |
||
| 971 | 960 | * @throws TypeError |
| 972 | 961 | * @psalm-suppress MixedArgument |
| 973 | 962 | */ |
| 974 | - public static function crypto_auth($message, $key) |
|
| 975 | - { |
|
| 963 | + public static function crypto_auth($message, $key) { |
|
| 976 | 964 | /* Type checks: */ |
| 977 | 965 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); |
| 978 | 966 | ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 2); |
@@ -999,8 +987,7 @@ discard block |
||
| 999 | 987 | * @throws Exception |
| 1000 | 988 | * @throws Error |
| 1001 | 989 | */ |
| 1002 | - public static function crypto_auth_keygen() |
|
| 1003 | - { |
|
| 990 | + public static function crypto_auth_keygen() { |
|
| 1004 | 991 | return random_bytes(self::CRYPTO_AUTH_KEYBYTES); |
| 1005 | 992 | } |
| 1006 | 993 | |
@@ -1016,8 +1003,7 @@ discard block |
||
| 1016 | 1003 | * @throws TypeError |
| 1017 | 1004 | * @psalm-suppress MixedArgument |
| 1018 | 1005 | */ |
| 1019 | - public static function crypto_auth_verify($mac, $message, $key) |
|
| 1020 | - { |
|
| 1006 | + public static function crypto_auth_verify($mac, $message, $key) { |
|
| 1021 | 1007 | /* Type checks: */ |
| 1022 | 1008 | ParagonIE_Sodium_Core_Util::declareScalarType($mac, 'string', 1); |
| 1023 | 1009 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 2); |
@@ -1060,8 +1046,7 @@ discard block |
||
| 1060 | 1046 | * @throws TypeError |
| 1061 | 1047 | * @psalm-suppress MixedArgument |
| 1062 | 1048 | */ |
| 1063 | - public static function crypto_box($plaintext, $nonce, $keypair) |
|
| 1064 | - { |
|
| 1049 | + public static function crypto_box($plaintext, $nonce, $keypair) { |
|
| 1065 | 1050 | /* Type checks: */ |
| 1066 | 1051 | ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1); |
| 1067 | 1052 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -1104,8 +1089,7 @@ discard block |
||
| 1104 | 1089 | * @throws TypeError |
| 1105 | 1090 | * @psalm-suppress MixedArgument |
| 1106 | 1091 | */ |
| 1107 | - public static function crypto_box_seal($plaintext, $publicKey) |
|
| 1108 | - { |
|
| 1092 | + public static function crypto_box_seal($plaintext, $publicKey) { |
|
| 1109 | 1093 | /* Type checks: */ |
| 1110 | 1094 | ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1); |
| 1111 | 1095 | ParagonIE_Sodium_Core_Util::declareScalarType($publicKey, 'string', 2); |
@@ -1142,8 +1126,7 @@ discard block |
||
| 1142 | 1126 | * @psalm-suppress MixedInferredReturnType |
| 1143 | 1127 | * @psalm-suppress MixedReturnStatement |
| 1144 | 1128 | */ |
| 1145 | - public static function crypto_box_seal_open($ciphertext, $keypair) |
|
| 1146 | - { |
|
| 1129 | + public static function crypto_box_seal_open($ciphertext, $keypair) { |
|
| 1147 | 1130 | /* Type checks: */ |
| 1148 | 1131 | ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); |
| 1149 | 1132 | ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 2); |
@@ -1180,8 +1163,7 @@ discard block |
||
| 1180 | 1163 | * @throws TypeError |
| 1181 | 1164 | * @psalm-suppress MixedArgument |
| 1182 | 1165 | */ |
| 1183 | - public static function crypto_box_keypair() |
|
| 1184 | - { |
|
| 1166 | + public static function crypto_box_keypair() { |
|
| 1185 | 1167 | if (self::useNewSodiumAPI()) { |
| 1186 | 1168 | return (string) sodium_crypto_box_keypair(); |
| 1187 | 1169 | } |
@@ -1205,8 +1187,7 @@ discard block |
||
| 1205 | 1187 | * @throws TypeError |
| 1206 | 1188 | * @psalm-suppress MixedArgument |
| 1207 | 1189 | */ |
| 1208 | - public static function crypto_box_keypair_from_secretkey_and_publickey($secretKey, $publicKey) |
|
| 1209 | - { |
|
| 1190 | + public static function crypto_box_keypair_from_secretkey_and_publickey($secretKey, $publicKey) { |
|
| 1210 | 1191 | /* Type checks: */ |
| 1211 | 1192 | ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); |
| 1212 | 1193 | ParagonIE_Sodium_Core_Util::declareScalarType($publicKey, 'string', 2); |
@@ -1244,8 +1225,7 @@ discard block |
||
| 1244 | 1225 | * @psalm-suppress MixedInferredReturnType |
| 1245 | 1226 | * @psalm-suppress MixedReturnStatement |
| 1246 | 1227 | */ |
| 1247 | - public static function crypto_box_open($ciphertext, $nonce, $keypair) |
|
| 1248 | - { |
|
| 1228 | + public static function crypto_box_open($ciphertext, $nonce, $keypair) { |
|
| 1249 | 1229 | /* Type checks: */ |
| 1250 | 1230 | ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); |
| 1251 | 1231 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -1287,8 +1267,7 @@ discard block |
||
| 1287 | 1267 | * @throws TypeError |
| 1288 | 1268 | * @psalm-suppress MixedArgument |
| 1289 | 1269 | */ |
| 1290 | - public static function crypto_box_publickey($keypair) |
|
| 1291 | - { |
|
| 1270 | + public static function crypto_box_publickey($keypair) { |
|
| 1292 | 1271 | /* Type checks: */ |
| 1293 | 1272 | ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); |
| 1294 | 1273 | |
@@ -1318,8 +1297,7 @@ discard block |
||
| 1318 | 1297 | * @throws TypeError |
| 1319 | 1298 | * @psalm-suppress MixedArgument |
| 1320 | 1299 | */ |
| 1321 | - public static function crypto_box_publickey_from_secretkey($secretKey) |
|
| 1322 | - { |
|
| 1300 | + public static function crypto_box_publickey_from_secretkey($secretKey) { |
|
| 1323 | 1301 | /* Type checks: */ |
| 1324 | 1302 | ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); |
| 1325 | 1303 | |
@@ -1349,8 +1327,7 @@ discard block |
||
| 1349 | 1327 | * @throws TypeError |
| 1350 | 1328 | * @psalm-suppress MixedArgument |
| 1351 | 1329 | */ |
| 1352 | - public static function crypto_box_secretkey($keypair) |
|
| 1353 | - { |
|
| 1330 | + public static function crypto_box_secretkey($keypair) { |
|
| 1354 | 1331 | /* Type checks: */ |
| 1355 | 1332 | ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); |
| 1356 | 1333 | |
@@ -1381,8 +1358,7 @@ discard block |
||
| 1381 | 1358 | * @psalm-suppress MixedArgument |
| 1382 | 1359 | * @psalm-suppress UndefinedFunction |
| 1383 | 1360 | */ |
| 1384 | - public static function crypto_box_seed_keypair($seed) |
|
| 1385 | - { |
|
| 1361 | + public static function crypto_box_seed_keypair($seed) { |
|
| 1386 | 1362 | /* Type checks: */ |
| 1387 | 1363 | ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1); |
| 1388 | 1364 | |
@@ -1411,8 +1387,7 @@ discard block |
||
| 1411 | 1387 | * @throws TypeError |
| 1412 | 1388 | * @psalm-suppress MixedArgument |
| 1413 | 1389 | */ |
| 1414 | - public static function crypto_generichash($message, $key = '', $length = self::CRYPTO_GENERICHASH_BYTES) |
|
| 1415 | - { |
|
| 1390 | + public static function crypto_generichash($message, $key = '', $length = self::CRYPTO_GENERICHASH_BYTES) { |
|
| 1416 | 1391 | /* Type checks: */ |
| 1417 | 1392 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); |
| 1418 | 1393 | if (is_null($key)) { |
@@ -1455,8 +1430,7 @@ discard block |
||
| 1455 | 1430 | * @psalm-suppress ReferenceConstraintViolation |
| 1456 | 1431 | * @psalm-suppress ConflictingReferenceConstraint |
| 1457 | 1432 | */ |
| 1458 | - public static function crypto_generichash_final(&$ctx, $length = self::CRYPTO_GENERICHASH_BYTES) |
|
| 1459 | - { |
|
| 1433 | + public static function crypto_generichash_final(&$ctx, $length = self::CRYPTO_GENERICHASH_BYTES) { |
|
| 1460 | 1434 | /* Type checks: */ |
| 1461 | 1435 | ParagonIE_Sodium_Core_Util::declareScalarType($ctx, 'string', 1); |
| 1462 | 1436 | ParagonIE_Sodium_Core_Util::declareScalarType($length, 'int', 2); |
@@ -1500,8 +1474,7 @@ discard block |
||
| 1500 | 1474 | * @throws TypeError |
| 1501 | 1475 | * @psalm-suppress MixedArgument |
| 1502 | 1476 | */ |
| 1503 | - public static function crypto_generichash_init($key = '', $length = self::CRYPTO_GENERICHASH_BYTES) |
|
| 1504 | - { |
|
| 1477 | + public static function crypto_generichash_init($key = '', $length = self::CRYPTO_GENERICHASH_BYTES) { |
|
| 1505 | 1478 | /* Type checks: */ |
| 1506 | 1479 | if (is_null($key)) { |
| 1507 | 1480 | $key = ''; |
@@ -1591,8 +1564,7 @@ discard block |
||
| 1591 | 1564 | * @psalm-suppress MixedArgument |
| 1592 | 1565 | * @psalm-suppress ReferenceConstraintViolation |
| 1593 | 1566 | */ |
| 1594 | - public static function crypto_generichash_update(&$ctx, $message) |
|
| 1595 | - { |
|
| 1567 | + public static function crypto_generichash_update(&$ctx, $message) { |
|
| 1596 | 1568 | /* Type checks: */ |
| 1597 | 1569 | ParagonIE_Sodium_Core_Util::declareScalarType($ctx, 'string', 1); |
| 1598 | 1570 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 2); |
@@ -1618,8 +1590,7 @@ discard block |
||
| 1618 | 1590 | * @throws Exception |
| 1619 | 1591 | * @throws Error |
| 1620 | 1592 | */ |
| 1621 | - public static function crypto_generichash_keygen() |
|
| 1622 | - { |
|
| 1593 | + public static function crypto_generichash_keygen() { |
|
| 1623 | 1594 | return random_bytes(self::CRYPTO_GENERICHASH_KEYBYTES); |
| 1624 | 1595 | } |
| 1625 | 1596 | |
@@ -1677,8 +1648,7 @@ discard block |
||
| 1677 | 1648 | * @throws Exception |
| 1678 | 1649 | * @throws Error |
| 1679 | 1650 | */ |
| 1680 | - public static function crypto_kdf_keygen() |
|
| 1681 | - { |
|
| 1651 | + public static function crypto_kdf_keygen() { |
|
| 1682 | 1652 | return random_bytes(self::CRYPTO_KDF_KEYBYTES); |
| 1683 | 1653 | } |
| 1684 | 1654 | |
@@ -1712,8 +1682,7 @@ discard block |
||
| 1712 | 1682 | * @throws TypeError |
| 1713 | 1683 | * @psalm-suppress MixedArgument |
| 1714 | 1684 | */ |
| 1715 | - public static function crypto_kx($my_secret, $their_public, $client_public, $server_public, $dontFallback = false) |
|
| 1716 | - { |
|
| 1685 | + public static function crypto_kx($my_secret, $their_public, $client_public, $server_public, $dontFallback = false) { |
|
| 1717 | 1686 | /* Type checks: */ |
| 1718 | 1687 | ParagonIE_Sodium_Core_Util::declareScalarType($my_secret, 'string', 1); |
| 1719 | 1688 | ParagonIE_Sodium_Core_Util::declareScalarType($their_public, 'string', 2); |
@@ -1774,8 +1743,7 @@ discard block |
||
| 1774 | 1743 | * @return string |
| 1775 | 1744 | * @throws SodiumException |
| 1776 | 1745 | */ |
| 1777 | - public static function crypto_kx_seed_keypair($seed) |
|
| 1778 | - { |
|
| 1746 | + public static function crypto_kx_seed_keypair($seed) { |
|
| 1779 | 1747 | ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1); |
| 1780 | 1748 | |
| 1781 | 1749 | $seed = (string) $seed; |
@@ -1793,8 +1761,7 @@ discard block |
||
| 1793 | 1761 | * @return string |
| 1794 | 1762 | * @throws Exception |
| 1795 | 1763 | */ |
| 1796 | - public static function crypto_kx_keypair() |
|
| 1797 | - { |
|
| 1764 | + public static function crypto_kx_keypair() { |
|
| 1798 | 1765 | $sk = self::randombytes_buf(self::CRYPTO_KX_SECRETKEYBYTES); |
| 1799 | 1766 | $pk = self::crypto_scalarmult_base($sk); |
| 1800 | 1767 | return $sk . $pk; |
@@ -1806,8 +1773,7 @@ discard block |
||
| 1806 | 1773 | * @return array{0: string, 1: string} |
| 1807 | 1774 | * @throws SodiumException |
| 1808 | 1775 | */ |
| 1809 | - public static function crypto_kx_client_session_keys($keypair, $serverPublicKey) |
|
| 1810 | - { |
|
| 1776 | + public static function crypto_kx_client_session_keys($keypair, $serverPublicKey) { |
|
| 1811 | 1777 | ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); |
| 1812 | 1778 | ParagonIE_Sodium_Core_Util::declareScalarType($serverPublicKey, 'string', 2); |
| 1813 | 1779 | |
@@ -1848,8 +1814,7 @@ discard block |
||
| 1848 | 1814 | * @return array{0: string, 1: string} |
| 1849 | 1815 | * @throws SodiumException |
| 1850 | 1816 | */ |
| 1851 | - public static function crypto_kx_server_session_keys($keypair, $clientPublicKey) |
|
| 1852 | - { |
|
| 1817 | + public static function crypto_kx_server_session_keys($keypair, $clientPublicKey) { |
|
| 1853 | 1818 | ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); |
| 1854 | 1819 | ParagonIE_Sodium_Core_Util::declareScalarType($clientPublicKey, 'string', 2); |
| 1855 | 1820 | |
@@ -1889,8 +1854,7 @@ discard block |
||
| 1889 | 1854 | * @return string |
| 1890 | 1855 | * @throws SodiumException |
| 1891 | 1856 | */ |
| 1892 | - public static function crypto_kx_secretkey($kp) |
|
| 1893 | - { |
|
| 1857 | + public static function crypto_kx_secretkey($kp) { |
|
| 1894 | 1858 | return ParagonIE_Sodium_Core_Util::substr( |
| 1895 | 1859 | $kp, |
| 1896 | 1860 | 0, |
@@ -1903,8 +1867,7 @@ discard block |
||
| 1903 | 1867 | * @return string |
| 1904 | 1868 | * @throws SodiumException |
| 1905 | 1869 | */ |
| 1906 | - public static function crypto_kx_publickey($kp) |
|
| 1907 | - { |
|
| 1870 | + public static function crypto_kx_publickey($kp) { |
|
| 1908 | 1871 | return ParagonIE_Sodium_Core_Util::substr( |
| 1909 | 1872 | $kp, |
| 1910 | 1873 | self::CRYPTO_KX_SECRETKEYBYTES, |
@@ -1924,8 +1887,7 @@ discard block |
||
| 1924 | 1887 | * @throws TypeError |
| 1925 | 1888 | * @psalm-suppress MixedArgument |
| 1926 | 1889 | */ |
| 1927 | - public static function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $alg = null) |
|
| 1928 | - { |
|
| 1890 | + public static function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $alg = null) { |
|
| 1929 | 1891 | ParagonIE_Sodium_Core_Util::declareScalarType($outlen, 'int', 1); |
| 1930 | 1892 | ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 2); |
| 1931 | 1893 | ParagonIE_Sodium_Core_Util::declareScalarType($salt, 'string', 3); |
@@ -1956,8 +1918,7 @@ discard block |
||
| 1956 | 1918 | * |
| 1957 | 1919 | * @return bool |
| 1958 | 1920 | */ |
| 1959 | - public static function crypto_pwhash_is_available() |
|
| 1960 | - { |
|
| 1921 | + public static function crypto_pwhash_is_available() { |
|
| 1961 | 1922 | if (self::useNewSodiumAPI()) { |
| 1962 | 1923 | return true; |
| 1963 | 1924 | } |
@@ -1976,8 +1937,7 @@ discard block |
||
| 1976 | 1937 | * @throws TypeError |
| 1977 | 1938 | * @psalm-suppress MixedArgument |
| 1978 | 1939 | */ |
| 1979 | - public static function crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
| 1980 | - { |
|
| 1940 | + public static function crypto_pwhash_str($passwd, $opslimit, $memlimit) { |
|
| 1981 | 1941 | ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); |
| 1982 | 1942 | ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2); |
| 1983 | 1943 | ParagonIE_Sodium_Core_Util::declareScalarType($memlimit, 'int', 3); |
@@ -2003,8 +1963,7 @@ discard block |
||
| 2003 | 1963 | * @return bool |
| 2004 | 1964 | * @throws SodiumException |
| 2005 | 1965 | */ |
| 2006 | - public static function crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit) |
|
| 2007 | - { |
|
| 1966 | + public static function crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit) { |
|
| 2008 | 1967 | ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 1); |
| 2009 | 1968 | ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2); |
| 2010 | 1969 | ParagonIE_Sodium_Core_Util::declareScalarType($memlimit, 'int', 3); |
@@ -2032,8 +1991,7 @@ discard block |
||
| 2032 | 1991 | * @throws TypeError |
| 2033 | 1992 | * @psalm-suppress MixedArgument |
| 2034 | 1993 | */ |
| 2035 | - public static function crypto_pwhash_str_verify($passwd, $hash) |
|
| 2036 | - { |
|
| 1994 | + public static function crypto_pwhash_str_verify($passwd, $hash) { |
|
| 2037 | 1995 | ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); |
| 2038 | 1996 | ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 2); |
| 2039 | 1997 | |
@@ -2059,8 +2017,7 @@ discard block |
||
| 2059 | 2017 | * @throws SodiumException |
| 2060 | 2018 | * @throws TypeError |
| 2061 | 2019 | */ |
| 2062 | - public static function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
| 2063 | - { |
|
| 2020 | + public static function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
| 2064 | 2021 | ParagonIE_Sodium_Core_Util::declareScalarType($outlen, 'int', 1); |
| 2065 | 2022 | ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 2); |
| 2066 | 2023 | ParagonIE_Sodium_Core_Util::declareScalarType($salt, 'string', 3); |
@@ -2100,8 +2057,7 @@ discard block |
||
| 2100 | 2057 | * |
| 2101 | 2058 | * @return bool |
| 2102 | 2059 | */ |
| 2103 | - public static function crypto_pwhash_scryptsalsa208sha256_is_available() |
|
| 2104 | - { |
|
| 2060 | + public static function crypto_pwhash_scryptsalsa208sha256_is_available() { |
|
| 2105 | 2061 | if (self::useNewSodiumAPI()) { |
| 2106 | 2062 | return true; |
| 2107 | 2063 | } |
@@ -2119,8 +2075,7 @@ discard block |
||
| 2119 | 2075 | * @throws SodiumException |
| 2120 | 2076 | * @throws TypeError |
| 2121 | 2077 | */ |
| 2122 | - public static function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
| 2123 | - { |
|
| 2078 | + public static function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) { |
|
| 2124 | 2079 | ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); |
| 2125 | 2080 | ParagonIE_Sodium_Core_Util::declareScalarType($opslimit, 'int', 2); |
| 2126 | 2081 | ParagonIE_Sodium_Core_Util::declareScalarType($memlimit, 'int', 3); |
@@ -2153,8 +2108,7 @@ discard block |
||
| 2153 | 2108 | * @throws SodiumException |
| 2154 | 2109 | * @throws TypeError |
| 2155 | 2110 | */ |
| 2156 | - public static function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
| 2157 | - { |
|
| 2111 | + public static function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) { |
|
| 2158 | 2112 | ParagonIE_Sodium_Core_Util::declareScalarType($passwd, 'string', 1); |
| 2159 | 2113 | ParagonIE_Sodium_Core_Util::declareScalarType($hash, 'string', 2); |
| 2160 | 2114 | |
@@ -2190,8 +2144,7 @@ discard block |
||
| 2190 | 2144 | * @throws TypeError |
| 2191 | 2145 | * @psalm-suppress MixedArgument |
| 2192 | 2146 | */ |
| 2193 | - public static function crypto_scalarmult($secretKey, $publicKey) |
|
| 2194 | - { |
|
| 2147 | + public static function crypto_scalarmult($secretKey, $publicKey) { |
|
| 2195 | 2148 | /* Type checks: */ |
| 2196 | 2149 | ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); |
| 2197 | 2150 | ParagonIE_Sodium_Core_Util::declareScalarType($publicKey, 'string', 2); |
@@ -2234,8 +2187,7 @@ discard block |
||
| 2234 | 2187 | * @psalm-suppress TooFewArguments |
| 2235 | 2188 | * @psalm-suppress MixedArgument |
| 2236 | 2189 | */ |
| 2237 | - public static function crypto_scalarmult_base($secretKey) |
|
| 2238 | - { |
|
| 2190 | + public static function crypto_scalarmult_base($secretKey) { |
|
| 2239 | 2191 | /* Type checks: */ |
| 2240 | 2192 | ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); |
| 2241 | 2193 | |
@@ -2272,8 +2224,7 @@ discard block |
||
| 2272 | 2224 | * @throws TypeError |
| 2273 | 2225 | * @psalm-suppress MixedArgument |
| 2274 | 2226 | */ |
| 2275 | - public static function crypto_secretbox($plaintext, $nonce, $key) |
|
| 2276 | - { |
|
| 2227 | + public static function crypto_secretbox($plaintext, $nonce, $key) { |
|
| 2277 | 2228 | /* Type checks: */ |
| 2278 | 2229 | ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1); |
| 2279 | 2230 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -2312,8 +2263,7 @@ discard block |
||
| 2312 | 2263 | * @psalm-suppress MixedInferredReturnType |
| 2313 | 2264 | * @psalm-suppress MixedReturnStatement |
| 2314 | 2265 | */ |
| 2315 | - public static function crypto_secretbox_open($ciphertext, $nonce, $key) |
|
| 2316 | - { |
|
| 2266 | + public static function crypto_secretbox_open($ciphertext, $nonce, $key) { |
|
| 2317 | 2267 | /* Type checks: */ |
| 2318 | 2268 | ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); |
| 2319 | 2269 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -2350,8 +2300,7 @@ discard block |
||
| 2350 | 2300 | * @throws Exception |
| 2351 | 2301 | * @throws Error |
| 2352 | 2302 | */ |
| 2353 | - public static function crypto_secretbox_keygen() |
|
| 2354 | - { |
|
| 2303 | + public static function crypto_secretbox_keygen() { |
|
| 2355 | 2304 | return random_bytes(self::CRYPTO_SECRETBOX_KEYBYTES); |
| 2356 | 2305 | } |
| 2357 | 2306 | |
@@ -2368,8 +2317,7 @@ discard block |
||
| 2368 | 2317 | * @throws TypeError |
| 2369 | 2318 | * @psalm-suppress MixedArgument |
| 2370 | 2319 | */ |
| 2371 | - public static function crypto_secretbox_xchacha20poly1305($plaintext, $nonce, $key) |
|
| 2372 | - { |
|
| 2320 | + public static function crypto_secretbox_xchacha20poly1305($plaintext, $nonce, $key) { |
|
| 2373 | 2321 | /* Type checks: */ |
| 2374 | 2322 | ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1); |
| 2375 | 2323 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -2398,8 +2346,7 @@ discard block |
||
| 2398 | 2346 | * @throws TypeError |
| 2399 | 2347 | * @psalm-suppress MixedArgument |
| 2400 | 2348 | */ |
| 2401 | - public static function crypto_secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key) |
|
| 2402 | - { |
|
| 2349 | + public static function crypto_secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key) { |
|
| 2403 | 2350 | /* Type checks: */ |
| 2404 | 2351 | ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1); |
| 2405 | 2352 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -2425,8 +2372,7 @@ discard block |
||
| 2425 | 2372 | * @throws Exception |
| 2426 | 2373 | * @throws SodiumException |
| 2427 | 2374 | */ |
| 2428 | - public static function crypto_secretstream_xchacha20poly1305_init_push($key) |
|
| 2429 | - { |
|
| 2375 | + public static function crypto_secretstream_xchacha20poly1305_init_push($key) { |
|
| 2430 | 2376 | if (PHP_INT_SIZE === 4) { |
| 2431 | 2377 | return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_init_push($key); |
| 2432 | 2378 | } |
@@ -2439,8 +2385,7 @@ discard block |
||
| 2439 | 2385 | * @return string Returns a state. |
| 2440 | 2386 | * @throws Exception |
| 2441 | 2387 | */ |
| 2442 | - public static function crypto_secretstream_xchacha20poly1305_init_pull($header, $key) |
|
| 2443 | - { |
|
| 2388 | + public static function crypto_secretstream_xchacha20poly1305_init_pull($header, $key) { |
|
| 2444 | 2389 | if (ParagonIE_Sodium_Core_Util::strlen($header) < self::CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES) { |
| 2445 | 2390 | throw new SodiumException( |
| 2446 | 2391 | 'header size should be SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES bytes' |
@@ -2460,8 +2405,7 @@ discard block |
||
| 2460 | 2405 | * @return string |
| 2461 | 2406 | * @throws SodiumException |
| 2462 | 2407 | */ |
| 2463 | - public static function crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) |
|
| 2464 | - { |
|
| 2408 | + public static function crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) { |
|
| 2465 | 2409 | if (PHP_INT_SIZE === 4) { |
| 2466 | 2410 | return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_push( |
| 2467 | 2411 | $state, |
@@ -2485,8 +2429,7 @@ discard block |
||
| 2485 | 2429 | * @return bool|array{0: string, 1: int} |
| 2486 | 2430 | * @throws SodiumException |
| 2487 | 2431 | */ |
| 2488 | - public static function crypto_secretstream_xchacha20poly1305_pull(&$state, $msg, $aad = '') |
|
| 2489 | - { |
|
| 2432 | + public static function crypto_secretstream_xchacha20poly1305_pull(&$state, $msg, $aad = '') { |
|
| 2490 | 2433 | if (PHP_INT_SIZE === 4) { |
| 2491 | 2434 | return ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_pull( |
| 2492 | 2435 | $state, |
@@ -2505,8 +2448,7 @@ discard block |
||
| 2505 | 2448 | * @return string |
| 2506 | 2449 | * @throws Exception |
| 2507 | 2450 | */ |
| 2508 | - public static function crypto_secretstream_xchacha20poly1305_keygen() |
|
| 2509 | - { |
|
| 2451 | + public static function crypto_secretstream_xchacha20poly1305_keygen() { |
|
| 2510 | 2452 | return random_bytes(self::CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES); |
| 2511 | 2453 | } |
| 2512 | 2454 | |
@@ -2515,8 +2457,7 @@ discard block |
||
| 2515 | 2457 | * @return void |
| 2516 | 2458 | * @throws SodiumException |
| 2517 | 2459 | */ |
| 2518 | - public static function crypto_secretstream_xchacha20poly1305_rekey(&$state) |
|
| 2519 | - { |
|
| 2460 | + public static function crypto_secretstream_xchacha20poly1305_rekey(&$state) { |
|
| 2520 | 2461 | if (PHP_INT_SIZE === 4) { |
| 2521 | 2462 | ParagonIE_Sodium_Crypto32::secretstream_xchacha20poly1305_rekey($state); |
| 2522 | 2463 | } else { |
@@ -2536,8 +2477,7 @@ discard block |
||
| 2536 | 2477 | * @psalm-suppress MixedInferredReturnType |
| 2537 | 2478 | * @psalm-suppress MixedReturnStatement |
| 2538 | 2479 | */ |
| 2539 | - public static function crypto_shorthash($message, $key) |
|
| 2540 | - { |
|
| 2480 | + public static function crypto_shorthash($message, $key) { |
|
| 2541 | 2481 | /* Type checks: */ |
| 2542 | 2482 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); |
| 2543 | 2483 | ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 2); |
@@ -2566,8 +2506,7 @@ discard block |
||
| 2566 | 2506 | * @throws Exception |
| 2567 | 2507 | * @throws Error |
| 2568 | 2508 | */ |
| 2569 | - public static function crypto_shorthash_keygen() |
|
| 2570 | - { |
|
| 2509 | + public static function crypto_shorthash_keygen() { |
|
| 2571 | 2510 | return random_bytes(self::CRYPTO_SHORTHASH_KEYBYTES); |
| 2572 | 2511 | } |
| 2573 | 2512 | |
@@ -2586,8 +2525,7 @@ discard block |
||
| 2586 | 2525 | * @psalm-suppress MixedInferredReturnType |
| 2587 | 2526 | * @psalm-suppress MixedReturnStatement |
| 2588 | 2527 | */ |
| 2589 | - public static function crypto_sign($message, $secretKey) |
|
| 2590 | - { |
|
| 2528 | + public static function crypto_sign($message, $secretKey) { |
|
| 2591 | 2529 | /* Type checks: */ |
| 2592 | 2530 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); |
| 2593 | 2531 | ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 2); |
@@ -2622,8 +2560,7 @@ discard block |
||
| 2622 | 2560 | * @psalm-suppress MixedInferredReturnType |
| 2623 | 2561 | * @psalm-suppress MixedReturnStatement |
| 2624 | 2562 | */ |
| 2625 | - public static function crypto_sign_open($signedMessage, $publicKey) |
|
| 2626 | - { |
|
| 2563 | + public static function crypto_sign_open($signedMessage, $publicKey) { |
|
| 2627 | 2564 | /* Type checks: */ |
| 2628 | 2565 | ParagonIE_Sodium_Core_Util::declareScalarType($signedMessage, 'string', 1); |
| 2629 | 2566 | ParagonIE_Sodium_Core_Util::declareScalarType($publicKey, 'string', 2); |
@@ -2659,8 +2596,7 @@ discard block |
||
| 2659 | 2596 | * @throws SodiumException |
| 2660 | 2597 | * @throws TypeError |
| 2661 | 2598 | */ |
| 2662 | - public static function crypto_sign_keypair() |
|
| 2663 | - { |
|
| 2599 | + public static function crypto_sign_keypair() { |
|
| 2664 | 2600 | if (self::useNewSodiumAPI()) { |
| 2665 | 2601 | return sodium_crypto_sign_keypair(); |
| 2666 | 2602 | } |
@@ -2679,8 +2615,7 @@ discard block |
||
| 2679 | 2615 | * @return string |
| 2680 | 2616 | * @throws SodiumException |
| 2681 | 2617 | */ |
| 2682 | - public static function crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk) |
|
| 2683 | - { |
|
| 2618 | + public static function crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk) { |
|
| 2684 | 2619 | ParagonIE_Sodium_Core_Util::declareScalarType($sk, 'string', 1); |
| 2685 | 2620 | ParagonIE_Sodium_Core_Util::declareScalarType($pk, 'string', 1); |
| 2686 | 2621 | $sk = (string) $sk; |
@@ -2708,8 +2643,7 @@ discard block |
||
| 2708 | 2643 | * @throws TypeError |
| 2709 | 2644 | * @psalm-suppress MixedArgument |
| 2710 | 2645 | */ |
| 2711 | - public static function crypto_sign_seed_keypair($seed) |
|
| 2712 | - { |
|
| 2646 | + public static function crypto_sign_seed_keypair($seed) { |
|
| 2713 | 2647 | ParagonIE_Sodium_Core_Util::declareScalarType($seed, 'string', 1); |
| 2714 | 2648 | |
| 2715 | 2649 | if (self::useNewSodiumAPI()) { |
@@ -2737,8 +2671,7 @@ discard block |
||
| 2737 | 2671 | * @throws TypeError |
| 2738 | 2672 | * @psalm-suppress MixedArgument |
| 2739 | 2673 | */ |
| 2740 | - public static function crypto_sign_publickey($keypair) |
|
| 2741 | - { |
|
| 2674 | + public static function crypto_sign_publickey($keypair) { |
|
| 2742 | 2675 | /* Type checks: */ |
| 2743 | 2676 | ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); |
| 2744 | 2677 | |
@@ -2768,8 +2701,7 @@ discard block |
||
| 2768 | 2701 | * @throws TypeError |
| 2769 | 2702 | * @psalm-suppress MixedArgument |
| 2770 | 2703 | */ |
| 2771 | - public static function crypto_sign_publickey_from_secretkey($secretKey) |
|
| 2772 | - { |
|
| 2704 | + public static function crypto_sign_publickey_from_secretkey($secretKey) { |
|
| 2773 | 2705 | /* Type checks: */ |
| 2774 | 2706 | ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1); |
| 2775 | 2707 | |
@@ -2799,8 +2731,7 @@ discard block |
||
| 2799 | 2731 | * @throws TypeError |
| 2800 | 2732 | * @psalm-suppress MixedArgument |
| 2801 | 2733 | */ |
| 2802 | - public static function crypto_sign_secretkey($keypair) |
|
| 2803 | - { |
|
| 2734 | + public static function crypto_sign_secretkey($keypair) { |
|
| 2804 | 2735 | /* Type checks: */ |
| 2805 | 2736 | ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1); |
| 2806 | 2737 | |
@@ -2833,8 +2764,7 @@ discard block |
||
| 2833 | 2764 | * @throws TypeError |
| 2834 | 2765 | * @psalm-suppress MixedArgument |
| 2835 | 2766 | */ |
| 2836 | - public static function crypto_sign_detached($message, $secretKey) |
|
| 2837 | - { |
|
| 2767 | + public static function crypto_sign_detached($message, $secretKey) { |
|
| 2838 | 2768 | /* Type checks: */ |
| 2839 | 2769 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); |
| 2840 | 2770 | ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 2); |
@@ -2868,8 +2798,7 @@ discard block |
||
| 2868 | 2798 | * @throws TypeError |
| 2869 | 2799 | * @psalm-suppress MixedArgument |
| 2870 | 2800 | */ |
| 2871 | - public static function crypto_sign_verify_detached($signature, $message, $publicKey) |
|
| 2872 | - { |
|
| 2801 | + public static function crypto_sign_verify_detached($signature, $message, $publicKey) { |
|
| 2873 | 2802 | /* Type checks: */ |
| 2874 | 2803 | ParagonIE_Sodium_Core_Util::declareScalarType($signature, 'string', 1); |
| 2875 | 2804 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 2); |
@@ -2909,8 +2838,7 @@ discard block |
||
| 2909 | 2838 | * @throws TypeError |
| 2910 | 2839 | * @psalm-suppress MixedArgument |
| 2911 | 2840 | */ |
| 2912 | - public static function crypto_sign_ed25519_pk_to_curve25519($pk) |
|
| 2913 | - { |
|
| 2841 | + public static function crypto_sign_ed25519_pk_to_curve25519($pk) { |
|
| 2914 | 2842 | /* Type checks: */ |
| 2915 | 2843 | ParagonIE_Sodium_Core_Util::declareScalarType($pk, 'string', 1); |
| 2916 | 2844 | |
@@ -2941,8 +2869,7 @@ discard block |
||
| 2941 | 2869 | * @throws TypeError |
| 2942 | 2870 | * @psalm-suppress MixedArgument |
| 2943 | 2871 | */ |
| 2944 | - public static function crypto_sign_ed25519_sk_to_curve25519($sk) |
|
| 2945 | - { |
|
| 2872 | + public static function crypto_sign_ed25519_sk_to_curve25519($sk) { |
|
| 2946 | 2873 | /* Type checks: */ |
| 2947 | 2874 | ParagonIE_Sodium_Core_Util::declareScalarType($sk, 'string', 1); |
| 2948 | 2875 | |
@@ -2983,8 +2910,7 @@ discard block |
||
| 2983 | 2910 | * @throws TypeError |
| 2984 | 2911 | * @psalm-suppress MixedArgument |
| 2985 | 2912 | */ |
| 2986 | - public static function crypto_stream($len, $nonce, $key) |
|
| 2987 | - { |
|
| 2913 | + public static function crypto_stream($len, $nonce, $key) { |
|
| 2988 | 2914 | /* Type checks: */ |
| 2989 | 2915 | ParagonIE_Sodium_Core_Util::declareScalarType($len, 'int', 1); |
| 2990 | 2916 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -3030,8 +2956,7 @@ discard block |
||
| 3030 | 2956 | * @throws TypeError |
| 3031 | 2957 | * @psalm-suppress MixedArgument |
| 3032 | 2958 | */ |
| 3033 | - public static function crypto_stream_xor($message, $nonce, $key) |
|
| 3034 | - { |
|
| 2959 | + public static function crypto_stream_xor($message, $nonce, $key) { |
|
| 3035 | 2960 | /* Type checks: */ |
| 3036 | 2961 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); |
| 3037 | 2962 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -3064,8 +2989,7 @@ discard block |
||
| 3064 | 2989 | * @throws Exception |
| 3065 | 2990 | * @throws Error |
| 3066 | 2991 | */ |
| 3067 | - public static function crypto_stream_keygen() |
|
| 3068 | - { |
|
| 2992 | + public static function crypto_stream_keygen() { |
|
| 3069 | 2993 | return random_bytes(self::CRYPTO_STREAM_KEYBYTES); |
| 3070 | 2994 | } |
| 3071 | 2995 | |
@@ -3085,8 +3009,7 @@ discard block |
||
| 3085 | 3009 | * @throws TypeError |
| 3086 | 3010 | * @psalm-suppress MixedArgument |
| 3087 | 3011 | */ |
| 3088 | - public static function crypto_stream_xchacha20($len, $nonce, $key, $dontFallback = false) |
|
| 3089 | - { |
|
| 3012 | + public static function crypto_stream_xchacha20($len, $nonce, $key, $dontFallback = false) { |
|
| 3090 | 3013 | /* Type checks: */ |
| 3091 | 3014 | ParagonIE_Sodium_Core_Util::declareScalarType($len, 'int', 1); |
| 3092 | 3015 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -3130,8 +3053,7 @@ discard block |
||
| 3130 | 3053 | * @throws TypeError |
| 3131 | 3054 | * @psalm-suppress MixedArgument |
| 3132 | 3055 | */ |
| 3133 | - public static function crypto_stream_xchacha20_xor($message, $nonce, $key, $dontFallback = false) |
|
| 3134 | - { |
|
| 3056 | + public static function crypto_stream_xchacha20_xor($message, $nonce, $key, $dontFallback = false) { |
|
| 3135 | 3057 | /* Type checks: */ |
| 3136 | 3058 | ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1); |
| 3137 | 3059 | ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2); |
@@ -3161,8 +3083,7 @@ discard block |
||
| 3161 | 3083 | * @throws Exception |
| 3162 | 3084 | * @throws Error |
| 3163 | 3085 | */ |
| 3164 | - public static function crypto_stream_xchacha20_keygen() |
|
| 3165 | - { |
|
| 3086 | + public static function crypto_stream_xchacha20_keygen() { |
|
| 3166 | 3087 | return random_bytes(self::CRYPTO_STREAM_XCHACHA20_KEYBYTES); |
| 3167 | 3088 | } |
| 3168 | 3089 | |
@@ -3176,8 +3097,7 @@ discard block |
||
| 3176 | 3097 | * @psalm-suppress TooFewArguments |
| 3177 | 3098 | * @psalm-suppress MixedArgument |
| 3178 | 3099 | */ |
| 3179 | - public static function hex2bin($string) |
|
| 3180 | - { |
|
| 3100 | + public static function hex2bin($string) { |
|
| 3181 | 3101 | /* Type checks: */ |
| 3182 | 3102 | ParagonIE_Sodium_Core_Util::declareScalarType($string, 'string', 1); |
| 3183 | 3103 | |
@@ -3202,8 +3122,7 @@ discard block |
||
| 3202 | 3122 | * @throws TypeError |
| 3203 | 3123 | * @psalm-suppress MixedArgument |
| 3204 | 3124 | */ |
| 3205 | - public static function increment(&$var) |
|
| 3206 | - { |
|
| 3125 | + public static function increment(&$var) { |
|
| 3207 | 3126 | /* Type checks: */ |
| 3208 | 3127 | ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1); |
| 3209 | 3128 | |
@@ -3236,8 +3155,7 @@ discard block |
||
| 3236 | 3155 | * |
| 3237 | 3156 | * @throws SodiumException |
| 3238 | 3157 | */ |
| 3239 | - public static function is_zero($str) |
|
| 3240 | - { |
|
| 3158 | + public static function is_zero($str) { |
|
| 3241 | 3159 | $d = 0; |
| 3242 | 3160 | for ($i = 0; $i < 32; ++$i) { |
| 3243 | 3161 | $d |= ParagonIE_Sodium_Core_Util::chrToInt($str[$i]); |
@@ -3251,8 +3169,7 @@ discard block |
||
| 3251 | 3169 | * |
| 3252 | 3170 | * @return int |
| 3253 | 3171 | */ |
| 3254 | - public static function library_version_major() |
|
| 3255 | - { |
|
| 3172 | + public static function library_version_major() { |
|
| 3256 | 3173 | if (self::useNewSodiumAPI() && defined('SODIUM_LIBRARY_MAJOR_VERSION')) { |
| 3257 | 3174 | return SODIUM_LIBRARY_MAJOR_VERSION; |
| 3258 | 3175 | } |
@@ -3269,8 +3186,7 @@ discard block |
||
| 3269 | 3186 | * |
| 3270 | 3187 | * @return int |
| 3271 | 3188 | */ |
| 3272 | - public static function library_version_minor() |
|
| 3273 | - { |
|
| 3189 | + public static function library_version_minor() { |
|
| 3274 | 3190 | if (self::useNewSodiumAPI() && defined('SODIUM_LIBRARY_MINOR_VERSION')) { |
| 3275 | 3191 | return SODIUM_LIBRARY_MINOR_VERSION; |
| 3276 | 3192 | } |
@@ -3291,8 +3207,7 @@ discard block |
||
| 3291 | 3207 | * @throws TypeError |
| 3292 | 3208 | * @psalm-suppress MixedArgument |
| 3293 | 3209 | */ |
| 3294 | - public static function memcmp($left, $right) |
|
| 3295 | - { |
|
| 3210 | + public static function memcmp($left, $right) { |
|
| 3296 | 3211 | /* Type checks: */ |
| 3297 | 3212 | ParagonIE_Sodium_Core_Util::declareScalarType($left, 'string', 1); |
| 3298 | 3213 | ParagonIE_Sodium_Core_Util::declareScalarType($right, 'string', 2); |
@@ -3320,8 +3235,7 @@ discard block |
||
| 3320 | 3235 | * @throws TypeError |
| 3321 | 3236 | * @psalm-suppress TooFewArguments |
| 3322 | 3237 | */ |
| 3323 | - public static function memzero(&$var) |
|
| 3324 | - { |
|
| 3238 | + public static function memzero(&$var) { |
|
| 3325 | 3239 | /* Type checks: */ |
| 3326 | 3240 | ParagonIE_Sodium_Core_Util::declareScalarType($var, 'string', 1); |
| 3327 | 3241 | |
@@ -3351,8 +3265,7 @@ discard block |
||
| 3351 | 3265 | * @return string |
| 3352 | 3266 | * @throws SodiumException |
| 3353 | 3267 | */ |
| 3354 | - public static function pad($unpadded, $blockSize, $dontFallback = false) |
|
| 3355 | - { |
|
| 3268 | + public static function pad($unpadded, $blockSize, $dontFallback = false) { |
|
| 3356 | 3269 | /* Type checks: */ |
| 3357 | 3270 | ParagonIE_Sodium_Core_Util::declareScalarType($unpadded, 'string', 1); |
| 3358 | 3271 | ParagonIE_Sodium_Core_Util::declareScalarType($blockSize, 'int', 2); |
@@ -3437,8 +3350,7 @@ discard block |
||
| 3437 | 3350 | * @return string |
| 3438 | 3351 | * @throws SodiumException |
| 3439 | 3352 | */ |
| 3440 | - public static function unpad($padded, $blockSize, $dontFallback = false) |
|
| 3441 | - { |
|
| 3353 | + public static function unpad($padded, $blockSize, $dontFallback = false) { |
|
| 3442 | 3354 | /* Type checks: */ |
| 3443 | 3355 | ParagonIE_Sodium_Core_Util::declareScalarType($padded, 'string', 1); |
| 3444 | 3356 | ParagonIE_Sodium_Core_Util::declareScalarType($blockSize, 'int', 2); |
@@ -3501,8 +3413,7 @@ discard block |
||
| 3501 | 3413 | * |
| 3502 | 3414 | * @return bool |
| 3503 | 3415 | */ |
| 3504 | - public static function polyfill_is_fast() |
|
| 3505 | - { |
|
| 3416 | + public static function polyfill_is_fast() { |
|
| 3506 | 3417 | if (extension_loaded('sodium')) { |
| 3507 | 3418 | return true; |
| 3508 | 3419 | } |
@@ -3521,8 +3432,7 @@ discard block |
||
| 3521 | 3432 | * @throws Exception |
| 3522 | 3433 | * @throws TypeError |
| 3523 | 3434 | */ |
| 3524 | - public static function randombytes_buf($numBytes) |
|
| 3525 | - { |
|
| 3435 | + public static function randombytes_buf($numBytes) { |
|
| 3526 | 3436 | /* Type checks: */ |
| 3527 | 3437 | if (!is_int($numBytes)) { |
| 3528 | 3438 | if (is_numeric($numBytes)) { |
@@ -3548,8 +3458,7 @@ discard block |
||
| 3548 | 3458 | * @throws Error |
| 3549 | 3459 | * @throws TypeError |
| 3550 | 3460 | */ |
| 3551 | - public static function randombytes_uniform($range) |
|
| 3552 | - { |
|
| 3461 | + public static function randombytes_uniform($range) { |
|
| 3553 | 3462 | /* Type checks: */ |
| 3554 | 3463 | if (!is_int($range)) { |
| 3555 | 3464 | if (is_numeric($range)) { |
@@ -3574,8 +3483,7 @@ discard block |
||
| 3574 | 3483 | * @throws Error |
| 3575 | 3484 | * @throws TypeError |
| 3576 | 3485 | */ |
| 3577 | - public static function randombytes_random16() |
|
| 3578 | - { |
|
| 3486 | + public static function randombytes_random16() { |
|
| 3579 | 3487 | if (self::use_fallback('randombytes_random16')) { |
| 3580 | 3488 | return (int) call_user_func('\\Sodium\\randombytes_random16'); |
| 3581 | 3489 | } |
@@ -3588,8 +3496,7 @@ discard block |
||
| 3588 | 3496 | * @return bool |
| 3589 | 3497 | * @throws SodiumException |
| 3590 | 3498 | */ |
| 3591 | - public static function ristretto255_is_valid_point($p, $dontFallback = false) |
|
| 3592 | - { |
|
| 3499 | + public static function ristretto255_is_valid_point($p, $dontFallback = false) { |
|
| 3593 | 3500 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3594 | 3501 | return sodium_crypto_core_ristretto255_is_valid_point($p); |
| 3595 | 3502 | } |
@@ -3612,8 +3519,7 @@ discard block |
||
| 3612 | 3519 | * @return string |
| 3613 | 3520 | * @throws SodiumException |
| 3614 | 3521 | */ |
| 3615 | - public static function ristretto255_add($p, $q, $dontFallback = false) |
|
| 3616 | - { |
|
| 3522 | + public static function ristretto255_add($p, $q, $dontFallback = false) { |
|
| 3617 | 3523 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3618 | 3524 | return sodium_crypto_core_ristretto255_add($p, $q); |
| 3619 | 3525 | } |
@@ -3627,8 +3533,7 @@ discard block |
||
| 3627 | 3533 | * @return string |
| 3628 | 3534 | * @throws SodiumException |
| 3629 | 3535 | */ |
| 3630 | - public static function ristretto255_sub($p, $q, $dontFallback = false) |
|
| 3631 | - { |
|
| 3536 | + public static function ristretto255_sub($p, $q, $dontFallback = false) { |
|
| 3632 | 3537 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3633 | 3538 | return sodium_crypto_core_ristretto255_sub($p, $q); |
| 3634 | 3539 | } |
@@ -3642,8 +3547,7 @@ discard block |
||
| 3642 | 3547 | * |
| 3643 | 3548 | * @throws SodiumException |
| 3644 | 3549 | */ |
| 3645 | - public static function ristretto255_from_hash($r, $dontFallback = false) |
|
| 3646 | - { |
|
| 3550 | + public static function ristretto255_from_hash($r, $dontFallback = false) { |
|
| 3647 | 3551 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3648 | 3552 | return sodium_crypto_core_ristretto255_from_hash($r); |
| 3649 | 3553 | } |
@@ -3656,8 +3560,7 @@ discard block |
||
| 3656 | 3560 | * |
| 3657 | 3561 | * @throws SodiumException |
| 3658 | 3562 | */ |
| 3659 | - public static function ristretto255_random($dontFallback = false) |
|
| 3660 | - { |
|
| 3563 | + public static function ristretto255_random($dontFallback = false) { |
|
| 3661 | 3564 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3662 | 3565 | return sodium_crypto_core_ristretto255_random(); |
| 3663 | 3566 | } |
@@ -3670,8 +3573,7 @@ discard block |
||
| 3670 | 3573 | * |
| 3671 | 3574 | * @throws SodiumException |
| 3672 | 3575 | */ |
| 3673 | - public static function ristretto255_scalar_random($dontFallback = false) |
|
| 3674 | - { |
|
| 3576 | + public static function ristretto255_scalar_random($dontFallback = false) { |
|
| 3675 | 3577 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3676 | 3578 | return sodium_crypto_core_ristretto255_scalar_random(); |
| 3677 | 3579 | } |
@@ -3684,8 +3586,7 @@ discard block |
||
| 3684 | 3586 | * @return string |
| 3685 | 3587 | * @throws SodiumException |
| 3686 | 3588 | */ |
| 3687 | - public static function ristretto255_scalar_invert($s, $dontFallback = false) |
|
| 3688 | - { |
|
| 3589 | + public static function ristretto255_scalar_invert($s, $dontFallback = false) { |
|
| 3689 | 3590 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3690 | 3591 | return sodium_crypto_core_ristretto255_scalar_invert($s); |
| 3691 | 3592 | } |
@@ -3697,8 +3598,7 @@ discard block |
||
| 3697 | 3598 | * @return string |
| 3698 | 3599 | * @throws SodiumException |
| 3699 | 3600 | */ |
| 3700 | - public static function ristretto255_scalar_negate($s, $dontFallback = false) |
|
| 3701 | - { |
|
| 3601 | + public static function ristretto255_scalar_negate($s, $dontFallback = false) { |
|
| 3702 | 3602 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3703 | 3603 | return sodium_crypto_core_ristretto255_scalar_negate($s); |
| 3704 | 3604 | } |
@@ -3711,8 +3611,7 @@ discard block |
||
| 3711 | 3611 | * @return string |
| 3712 | 3612 | * @throws SodiumException |
| 3713 | 3613 | */ |
| 3714 | - public static function ristretto255_scalar_complement($s, $dontFallback = false) |
|
| 3715 | - { |
|
| 3614 | + public static function ristretto255_scalar_complement($s, $dontFallback = false) { |
|
| 3716 | 3615 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3717 | 3616 | return sodium_crypto_core_ristretto255_scalar_complement($s); |
| 3718 | 3617 | } |
@@ -3726,8 +3625,7 @@ discard block |
||
| 3726 | 3625 | * @return string |
| 3727 | 3626 | * @throws SodiumException |
| 3728 | 3627 | */ |
| 3729 | - public static function ristretto255_scalar_add($x, $y, $dontFallback = false) |
|
| 3730 | - { |
|
| 3628 | + public static function ristretto255_scalar_add($x, $y, $dontFallback = false) { |
|
| 3731 | 3629 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3732 | 3630 | return sodium_crypto_core_ristretto255_scalar_add($x, $y); |
| 3733 | 3631 | } |
@@ -3741,8 +3639,7 @@ discard block |
||
| 3741 | 3639 | * @return string |
| 3742 | 3640 | * @throws SodiumException |
| 3743 | 3641 | */ |
| 3744 | - public static function ristretto255_scalar_sub($x, $y, $dontFallback = false) |
|
| 3745 | - { |
|
| 3642 | + public static function ristretto255_scalar_sub($x, $y, $dontFallback = false) { |
|
| 3746 | 3643 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3747 | 3644 | return sodium_crypto_core_ristretto255_scalar_sub($x, $y); |
| 3748 | 3645 | } |
@@ -3756,8 +3653,7 @@ discard block |
||
| 3756 | 3653 | * @return string |
| 3757 | 3654 | * @throws SodiumException |
| 3758 | 3655 | */ |
| 3759 | - public static function ristretto255_scalar_mul($x, $y, $dontFallback = false) |
|
| 3760 | - { |
|
| 3656 | + public static function ristretto255_scalar_mul($x, $y, $dontFallback = false) { |
|
| 3761 | 3657 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3762 | 3658 | return sodium_crypto_core_ristretto255_scalar_mul($x, $y); |
| 3763 | 3659 | } |
@@ -3771,8 +3667,7 @@ discard block |
||
| 3771 | 3667 | * @return string |
| 3772 | 3668 | * @throws SodiumException |
| 3773 | 3669 | */ |
| 3774 | - public static function scalarmult_ristretto255($n, $p, $dontFallback = false) |
|
| 3775 | - { |
|
| 3670 | + public static function scalarmult_ristretto255($n, $p, $dontFallback = false) { |
|
| 3776 | 3671 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3777 | 3672 | return sodium_crypto_scalarmult_ristretto255($n, $p); |
| 3778 | 3673 | } |
@@ -3786,8 +3681,7 @@ discard block |
||
| 3786 | 3681 | * @return string |
| 3787 | 3682 | * @throws SodiumException |
| 3788 | 3683 | */ |
| 3789 | - public static function scalarmult_ristretto255_base($n, $dontFallback = false) |
|
| 3790 | - { |
|
| 3684 | + public static function scalarmult_ristretto255_base($n, $dontFallback = false) { |
|
| 3791 | 3685 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3792 | 3686 | return sodium_crypto_scalarmult_ristretto255_base($n); |
| 3793 | 3687 | } |
@@ -3800,8 +3694,7 @@ discard block |
||
| 3800 | 3694 | * @return string |
| 3801 | 3695 | * @throws SodiumException |
| 3802 | 3696 | */ |
| 3803 | - public static function ristretto255_scalar_reduce($s, $dontFallback = false) |
|
| 3804 | - { |
|
| 3697 | + public static function ristretto255_scalar_reduce($s, $dontFallback = false) { |
|
| 3805 | 3698 | if (self::useNewSodiumAPI() && !$dontFallback) { |
| 3806 | 3699 | return sodium_crypto_core_ristretto255_scalar_reduce($s); |
| 3807 | 3700 | } |
@@ -3821,8 +3714,7 @@ discard block |
||
| 3821 | 3714 | * @return bool TRUE if we're fast enough, FALSE is not |
| 3822 | 3715 | * @throws SodiumException |
| 3823 | 3716 | */ |
| 3824 | - public static function runtime_speed_test($iterations, $maxTimeout) |
|
| 3825 | - { |
|
| 3717 | + public static function runtime_speed_test($iterations, $maxTimeout) { |
|
| 3826 | 3718 | if (self::polyfill_is_fast()) { |
| 3827 | 3719 | return true; |
| 3828 | 3720 | } |
@@ -3855,8 +3747,7 @@ discard block |
||
| 3855 | 3747 | * @return void |
| 3856 | 3748 | * @throws SodiumException |
| 3857 | 3749 | */ |
| 3858 | - public static function sub(&$val, $addv) |
|
| 3859 | - { |
|
| 3750 | + public static function sub(&$val, $addv) { |
|
| 3860 | 3751 | $val_len = ParagonIE_Sodium_Core_Util::strlen($val); |
| 3861 | 3752 | $addv_len = ParagonIE_Sodium_Core_Util::strlen($addv); |
| 3862 | 3753 | if ($val_len !== $addv_len) { |
@@ -3882,8 +3773,7 @@ discard block |
||
| 3882 | 3773 | * @psalm-suppress MixedInferredReturnType |
| 3883 | 3774 | * @psalm-suppress UndefinedFunction |
| 3884 | 3775 | */ |
| 3885 | - public static function version_string() |
|
| 3886 | - { |
|
| 3776 | + public static function version_string() { |
|
| 3887 | 3777 | if (self::useNewSodiumAPI()) { |
| 3888 | 3778 | return (string) sodium_version_string(); |
| 3889 | 3779 | } |
@@ -3905,8 +3795,7 @@ discard block |
||
| 3905 | 3795 | * |
| 3906 | 3796 | * @return bool |
| 3907 | 3797 | */ |
| 3908 | - protected static function use_fallback($sodium_func_name = '') |
|
| 3909 | - { |
|
| 3798 | + protected static function use_fallback($sodium_func_name = '') { |
|
| 3910 | 3799 | static $res = null; |
| 3911 | 3800 | if ($res === null) { |
| 3912 | 3801 | $res = extension_loaded('libsodium') && PHP_VERSION_ID >= 50300; |
@@ -3932,8 +3821,7 @@ discard block |
||
| 3932 | 3821 | * @ref https://wiki.php.net/rfc/libsodium |
| 3933 | 3822 | * @return bool |
| 3934 | 3823 | */ |
| 3935 | - protected static function useNewSodiumAPI() |
|
| 3936 | - { |
|
| 3824 | + protected static function useNewSodiumAPI() { |
|
| 3937 | 3825 | static $res = null; |
| 3938 | 3826 | if ($res === null) { |
| 3939 | 3827 | $res = PHP_VERSION_ID >= 70000 && extension_loaded('sodium'); |