@@ -76,11 +76,11 @@ |
||
76 | 76 | |
77 | 77 | $routines = array(); |
78 | 78 | |
79 | - if ( empty( $this->uninstallers[ $context ] ) ) { |
|
79 | + if ( empty( $this->uninstallers[$context] ) ) { |
|
80 | 80 | return $routines; |
81 | 81 | } |
82 | 82 | |
83 | - foreach ( $this->uninstallers[ $context ] as $data ) { |
|
83 | + foreach ( $this->uninstallers[$context] as $data ) { |
|
84 | 84 | |
85 | 85 | if ( is_string( $data ) ) { |
86 | 86 | $class = $data; |
@@ -137,7 +137,7 @@ |
||
137 | 137 | // So we get all of the per-site versions. |
138 | 138 | foreach ( $this->installable->get_installed_site_ids() as $site_id ) { |
139 | 139 | switch_to_blog( $site_id ); |
140 | - $versions[ $site_id ] = $this->installable->get_db_version(); |
|
140 | + $versions[$site_id] = $this->installable->get_db_version(); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $ms_switched_state->restore(); |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function get_component( $slug ) { |
196 | 196 | |
197 | - if ( ! isset( $this->registered[ $slug ] ) ) { |
|
197 | + if ( ! isset( $this->registered[$slug] ) ) { |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
201 | - return $this->registered[ $slug ]; |
|
201 | + return $this->registered[$slug]; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function is_registered( $slug ) { |
230 | 230 | |
231 | - return isset( $this->registered[ $slug ] ); |
|
231 | + return isset( $this->registered[$slug] ); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | return false; |
285 | 285 | } |
286 | 286 | |
287 | - $this->registered[ $component['slug'] ] = array_intersect_key( $component, $defaults ); |
|
287 | + $this->registered[$component['slug']] = array_intersect_key( $component, $defaults ); |
|
288 | 288 | |
289 | 289 | if ( |
290 | 290 | ! isset( $component['installable'] ) |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function deregister( $slug ) { |
317 | 317 | |
318 | - if ( isset( $this->registered[ $slug ] ) ) { |
|
318 | + if ( isset( $this->registered[$slug] ) ) { |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Component being deregistered. |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | do_action( "wordpoints_component_deregister-{$slug}" ); |
326 | 326 | |
327 | - unset( $this->registered[ $slug ] ); |
|
327 | + unset( $this->registered[$slug] ); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | return true; |
@@ -356,17 +356,17 @@ discard block |
||
356 | 356 | // If this component isn't already active, activate it. |
357 | 357 | if ( ! $this->is_active( $slug ) ) { |
358 | 358 | |
359 | - $this->active[ $slug ] = 1; |
|
359 | + $this->active[$slug] = 1; |
|
360 | 360 | |
361 | 361 | if ( ! wordpoints_update_maybe_network_option( 'wordpoints_active_components', $this->active ) ) { |
362 | 362 | return false; |
363 | 363 | } |
364 | 364 | |
365 | - require_once $this->registered[ $slug ]['file']; |
|
365 | + require_once $this->registered[$slug]['file']; |
|
366 | 366 | |
367 | - if ( isset( $this->registered[ $slug ]['installable'] ) ) { |
|
367 | + if ( isset( $this->registered[$slug]['installable'] ) ) { |
|
368 | 368 | |
369 | - $installable = $this->registered[ $slug ]['installable']; |
|
369 | + $installable = $this->registered[$slug]['installable']; |
|
370 | 370 | $installable = new $installable( $slug ); |
371 | 371 | |
372 | 372 | $installer = new WordPoints_Installer( |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | WordPoints_Installables::get_installer( |
382 | 382 | 'component' |
383 | 383 | , $slug |
384 | - , $this->registered[ $slug ]['version'] |
|
385 | - , $this->registered[ $slug ]['un_installer'] |
|
384 | + , $this->registered[$slug]['version'] |
|
385 | + , $this->registered[$slug]['un_installer'] |
|
386 | 386 | ) |
387 | 387 | ->install( is_wordpoints_network_active() ); |
388 | 388 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | if ( $this->is_active( $slug ) ) { |
422 | 422 | |
423 | - unset( $this->active[ $slug ] ); |
|
423 | + unset( $this->active[$slug] ); |
|
424 | 424 | |
425 | 425 | if ( ! wordpoints_update_maybe_network_option( 'wordpoints_active_components', $this->active ) ) { |
426 | 426 | return false; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | |
454 | 454 | $this->get_active(); |
455 | 455 | |
456 | - $is_active = isset( $this->active[ $slug ] ); |
|
456 | + $is_active = isset( $this->active[$slug] ); |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * Is a component active? |
@@ -602,7 +602,7 @@ |
||
602 | 602 | return false; |
603 | 603 | } |
604 | 604 | |
605 | - $current_context[ $slug ] = $id; |
|
605 | + $current_context[$slug] = $id; |
|
606 | 606 | |
607 | 607 | $slug = $context->get_parent_slug(); |
608 | 608 | } |
@@ -454,7 +454,7 @@ |
||
454 | 454 | $the_guid = $entity->get_the_guid(); |
455 | 455 | |
456 | 456 | if ( $the_guid ) { |
457 | - $the_guids[ $arg_slug ] = $the_guid; |
|
457 | + $the_guids[$arg_slug] = $the_guid; |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $modules = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' ); |
64 | 64 | |
65 | - if ( isset( $modules[ $module ] ) ) { |
|
65 | + if ( isset( $modules[$module] ) ) { |
|
66 | 66 | return true; |
67 | 67 | } |
68 | 68 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | foreach ( array( 'name', 'uri', 'module_uri', 'description', 'author', 'author_uri', 'version' ) as $field ) { |
498 | 498 | |
499 | - $module_data[ $field ] = translate( $module_data[ $field ], $textdomain ); // @codingStandardsIgnoreLine |
|
499 | + $module_data[$field] = translate( $module_data[$field], $textdomain ); // @codingStandardsIgnoreLine |
|
500 | 500 | } |
501 | 501 | } |
502 | 502 | } |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | $allowed_tags['a'] = array( 'href' => true, 'title' => true ); |
515 | 515 | |
516 | 516 | // Name and author ar marked up inside <a> tags. Don't allow these. |
517 | - $module_data['name'] = wp_kses( $module_data['name'] , $allowed_tags_in_links ); |
|
517 | + $module_data['name'] = wp_kses( $module_data['name'], $allowed_tags_in_links ); |
|
518 | 518 | $module_data['author'] = wp_kses( $module_data['author'], $allowed_tags_in_links ); |
519 | 519 | |
520 | 520 | $module_data['description'] = wp_kses( $module_data['description'], $allowed_tags ); |
521 | - $module_data['version'] = wp_kses( $module_data['version'] , $allowed_tags ); |
|
521 | + $module_data['version'] = wp_kses( $module_data['version'], $allowed_tags ); |
|
522 | 522 | |
523 | 523 | $module_data['uri'] = esc_url( $module_data['uri'] ); |
524 | 524 | $module_data['module_uri'] = esc_url( $module_data['module_uri'] ); |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | $cache_modules = array(); |
684 | 684 | } |
685 | 685 | |
686 | - if ( isset( $cache_modules[ $module_folder ] ) ) { |
|
687 | - return $cache_modules[ $module_folder ]; |
|
686 | + if ( isset( $cache_modules[$module_folder] ) ) { |
|
687 | + return $cache_modules[$module_folder]; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | $modules = array(); |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | $module_file = basename( $module_file ); |
739 | 739 | } |
740 | 740 | |
741 | - $modules[ $module_file ] = $module_data; |
|
741 | + $modules[$module_file] = $module_data; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | uasort( $modules, '_wordpoints_sort_uname_callback' ); |
745 | 745 | |
746 | - $cache_modules[ $module_folder ] = $modules; |
|
746 | + $cache_modules[$module_folder] = $modules; |
|
747 | 747 | wp_cache_set( 'wordpoints_modules', $cache_modules, 'wordpoints_modules' ); |
748 | 748 | |
749 | 749 | return $modules; |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | $installed_modules = wordpoints_get_modules(); |
772 | 772 | |
773 | - if ( ! isset( $installed_modules[ $module ] ) ) { |
|
773 | + if ( ! isset( $installed_modules[$module] ) ) { |
|
774 | 774 | return new WP_Error( 'no_module_header', __( 'The extension does not have a valid header.', 'wordpoints' ) ); |
775 | 775 | } |
776 | 776 | |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | $result = wordpoints_validate_module( $module ); |
808 | 808 | |
809 | 809 | if ( is_wp_error( $result ) ) { |
810 | - $invalid[ $module ] = $result; |
|
810 | + $invalid[$module] = $result; |
|
811 | 811 | wordpoints_deactivate_modules( $module, true ); |
812 | 812 | } |
813 | 813 | } |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | |
947 | 947 | if ( $network_wide ) { |
948 | 948 | |
949 | - $network_current[ $module ] = time(); |
|
949 | + $network_current[$module] = time(); |
|
950 | 950 | update_site_option( 'wordpoints_sitewide_active_modules', $network_current ); |
951 | 951 | |
952 | 952 | } else { |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | if ( is_wordpoints_module_active_for_network( $module ) ) { |
1036 | 1036 | |
1037 | 1037 | $do_network = true; |
1038 | - unset( $network_current[ $module ] ); |
|
1038 | + unset( $network_current[$module] ); |
|
1039 | 1039 | |
1040 | 1040 | } elseif ( $network_wide ) { |
1041 | 1041 | |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | if ( false !== $key ) { |
1051 | 1051 | |
1052 | 1052 | $do_blog = true; |
1053 | - unset( $current[ $key ] ); |
|
1053 | + unset( $current[$key] ); |
|
1054 | 1054 | } |
1055 | 1055 | } |
1056 | 1056 | |
@@ -1616,10 +1616,10 @@ discard block |
||
1616 | 1616 | if ( |
1617 | 1617 | empty( $data['ID'] ) |
1618 | 1618 | && ( 'J.D. Grimes' === $data['author'] || 'WordPoints' === $data['author'] ) |
1619 | - && isset( $missing_headers[ $data['name'] ] ) |
|
1619 | + && isset( $missing_headers[$data['name']] ) |
|
1620 | 1620 | ) { |
1621 | 1621 | $data['server'] = 'wordpoints.org'; |
1622 | - $data['ID'] = $missing_headers[ $data['name'] ]; |
|
1622 | + $data['ID'] = $missing_headers[$data['name']]; |
|
1623 | 1623 | } |
1624 | 1624 | |
1625 | 1625 | return $data; |
@@ -84,7 +84,8 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return bool True if the module is network only, false otherwise. |
86 | 86 | */ |
87 | -function is_network_only_wordpoints_module( $module ) { // @codingStandardsIgnoreLine |
|
87 | +function is_network_only_wordpoints_module( $module ) { |
|
88 | +// @codingStandardsIgnoreLine |
|
88 | 89 | |
89 | 90 | $module_data = wordpoints_get_module_data( wordpoints_extensions_dir() . '/' . $module ); |
90 | 91 | |
@@ -100,7 +101,8 @@ discard block |
||
100 | 101 | * |
101 | 102 | * @return bool True if the module has an uninstall script, false otherwise. |
102 | 103 | */ |
103 | -function is_uninstallable_wordpoints_module( $module ) { // @codingStandardsIgnoreLine |
|
104 | +function is_uninstallable_wordpoints_module( $module ) { |
|
105 | +// @codingStandardsIgnoreLine |
|
104 | 106 | |
105 | 107 | return ( file_exists( wordpoints_extensions_dir() . '/' . dirname( wordpoints_module_basename( $module ) ) . '/uninstall.php' ) ); |
106 | 108 | } |
@@ -90,11 +90,11 @@ |
||
90 | 90 | |
91 | 91 | $routines = array(); |
92 | 92 | |
93 | - if ( empty( $this->updates[ $context ] ) ) { |
|
93 | + if ( empty( $this->updates[$context] ) ) { |
|
94 | 94 | return $routines; |
95 | 95 | } |
96 | 96 | |
97 | - foreach ( $this->updates[ $context ] as $data ) { |
|
97 | + foreach ( $this->updates[$context] as $data ) { |
|
98 | 98 | |
99 | 99 | if ( $data instanceof WordPoints_RoutineI ) { |
100 | 100 | $routines[] = $data; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @param string $message |
241 | 241 | * @param string $nonce |
242 | 242 | * @param string $kp |
243 | - * @return string|bool |
|
243 | + * @return string|false |
|
244 | 244 | */ |
245 | 245 | function sodium_crypto_box_open($message, $nonce, $kp) |
246 | 246 | { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | /** |
289 | 289 | * @param string $message |
290 | 290 | * @param string $kp |
291 | - * @return string|bool |
|
291 | + * @return string|false |
|
292 | 292 | */ |
293 | 293 | function sodium_crypto_box_seal_open($message, $kp) |
294 | 294 | { |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @param string $message |
497 | 497 | * @param string $nonce |
498 | 498 | * @param string $key |
499 | - * @return string|bool |
|
499 | + * @return string|false |
|
500 | 500 | */ |
501 | 501 | function sodium_crypto_secretbox_open($message, $nonce, $key) |
502 | 502 | { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | /** |
556 | 556 | * @param string $signedMessage |
557 | 557 | * @param string $pk |
558 | - * @return string|bool |
|
558 | + * @return string|false |
|
559 | 559 | */ |
560 | 560 | function sodium_crypto_sign_open($signedMessage, $pk) |
561 | 561 | { |
@@ -8,738 +8,738 @@ |
||
8 | 8 | * ParagonIE_Sodium_Compat method or class constant, respectively. |
9 | 9 | */ |
10 | 10 | foreach (array( |
11 | - 'CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES', |
|
12 | - 'CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES', |
|
13 | - 'CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES', |
|
14 | - 'CRYPTO_AEAD_CHACHA20POLY1305_ABYTES', |
|
15 | - 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES', |
|
16 | - 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES', |
|
17 | - 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES', |
|
18 | - 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES', |
|
19 | - 'CRYPTO_AUTH_BYTES', |
|
20 | - 'CRYPTO_AUTH_KEYBYTES', |
|
21 | - 'CRYPTO_BOX_SEALBYTES', |
|
22 | - 'CRYPTO_BOX_SECRETKEYBYTES', |
|
23 | - 'CRYPTO_BOX_PUBLICKEYBYTES', |
|
24 | - 'CRYPTO_BOX_KEYPAIRBYTES', |
|
25 | - 'CRYPTO_BOX_MACBYTES', |
|
26 | - 'CRYPTO_BOX_NONCEBYTES', |
|
27 | - 'CRYPTO_BOX_SEEDBYTES', |
|
28 | - 'CRYPTO_KX_BYTES', |
|
29 | - 'CRYPTO_KX_PUBLICKEYBYTES', |
|
30 | - 'CRYPTO_KX_SECRETKEYBYTES', |
|
31 | - 'CRYPTO_GENERICHASH_BYTES', |
|
32 | - 'CRYPTO_GENERICHASH_BYTES_MIN', |
|
33 | - 'CRYPTO_GENERICHASH_BYTES_MAX', |
|
34 | - 'CRYPTO_GENERICHASH_KEYBYTES', |
|
35 | - 'CRYPTO_GENERICHASH_KEYBYTES_MIN', |
|
36 | - 'CRYPTO_GENERICHASH_KEYBYTES_MAX', |
|
37 | - 'CRYPTO_PWHASH_SALTBYTES', |
|
38 | - 'CRYPTO_PWHASH_STRPREFIX', |
|
39 | - 'CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE', |
|
40 | - 'CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE', |
|
41 | - 'CRYPTO_PWHASH_MEMLIMIT_MODERATE', |
|
42 | - 'CRYPTO_PWHASH_OPSLIMIT_MODERATE', |
|
43 | - 'CRYPTO_PWHASH_MEMLIMIT_SENSITIVE', |
|
44 | - 'CRYPTO_PWHASH_OPSLIMIT_SENSITIVE', |
|
45 | - 'CRYPTO_SCALARMULT_BYTES', |
|
46 | - 'CRYPTO_SCALARMULT_SCALARBYTES', |
|
47 | - 'CRYPTO_SHORTHASH_BYTES', |
|
48 | - 'CRYPTO_SHORTHASH_KEYBYTES', |
|
49 | - 'CRYPTO_SECRETBOX_KEYBYTES', |
|
50 | - 'CRYPTO_SECRETBOX_MACBYTES', |
|
51 | - 'CRYPTO_SECRETBOX_NONCEBYTES', |
|
52 | - 'CRYPTO_SIGN_BYTES', |
|
53 | - 'CRYPTO_SIGN_SEEDBYTES', |
|
54 | - 'CRYPTO_SIGN_PUBLICKEYBYTES', |
|
55 | - 'CRYPTO_SIGN_SECRETKEYBYTES', |
|
56 | - 'CRYPTO_SIGN_KEYPAIRBYTES', |
|
57 | - 'CRYPTO_STREAM_KEYBYTES', |
|
58 | - 'CRYPTO_STREAM_NONCEBYTES', |
|
59 | - ) as $constant |
|
11 | + 'CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES', |
|
12 | + 'CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES', |
|
13 | + 'CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES', |
|
14 | + 'CRYPTO_AEAD_CHACHA20POLY1305_ABYTES', |
|
15 | + 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES', |
|
16 | + 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES', |
|
17 | + 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES', |
|
18 | + 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES', |
|
19 | + 'CRYPTO_AUTH_BYTES', |
|
20 | + 'CRYPTO_AUTH_KEYBYTES', |
|
21 | + 'CRYPTO_BOX_SEALBYTES', |
|
22 | + 'CRYPTO_BOX_SECRETKEYBYTES', |
|
23 | + 'CRYPTO_BOX_PUBLICKEYBYTES', |
|
24 | + 'CRYPTO_BOX_KEYPAIRBYTES', |
|
25 | + 'CRYPTO_BOX_MACBYTES', |
|
26 | + 'CRYPTO_BOX_NONCEBYTES', |
|
27 | + 'CRYPTO_BOX_SEEDBYTES', |
|
28 | + 'CRYPTO_KX_BYTES', |
|
29 | + 'CRYPTO_KX_PUBLICKEYBYTES', |
|
30 | + 'CRYPTO_KX_SECRETKEYBYTES', |
|
31 | + 'CRYPTO_GENERICHASH_BYTES', |
|
32 | + 'CRYPTO_GENERICHASH_BYTES_MIN', |
|
33 | + 'CRYPTO_GENERICHASH_BYTES_MAX', |
|
34 | + 'CRYPTO_GENERICHASH_KEYBYTES', |
|
35 | + 'CRYPTO_GENERICHASH_KEYBYTES_MIN', |
|
36 | + 'CRYPTO_GENERICHASH_KEYBYTES_MAX', |
|
37 | + 'CRYPTO_PWHASH_SALTBYTES', |
|
38 | + 'CRYPTO_PWHASH_STRPREFIX', |
|
39 | + 'CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE', |
|
40 | + 'CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE', |
|
41 | + 'CRYPTO_PWHASH_MEMLIMIT_MODERATE', |
|
42 | + 'CRYPTO_PWHASH_OPSLIMIT_MODERATE', |
|
43 | + 'CRYPTO_PWHASH_MEMLIMIT_SENSITIVE', |
|
44 | + 'CRYPTO_PWHASH_OPSLIMIT_SENSITIVE', |
|
45 | + 'CRYPTO_SCALARMULT_BYTES', |
|
46 | + 'CRYPTO_SCALARMULT_SCALARBYTES', |
|
47 | + 'CRYPTO_SHORTHASH_BYTES', |
|
48 | + 'CRYPTO_SHORTHASH_KEYBYTES', |
|
49 | + 'CRYPTO_SECRETBOX_KEYBYTES', |
|
50 | + 'CRYPTO_SECRETBOX_MACBYTES', |
|
51 | + 'CRYPTO_SECRETBOX_NONCEBYTES', |
|
52 | + 'CRYPTO_SIGN_BYTES', |
|
53 | + 'CRYPTO_SIGN_SEEDBYTES', |
|
54 | + 'CRYPTO_SIGN_PUBLICKEYBYTES', |
|
55 | + 'CRYPTO_SIGN_SECRETKEYBYTES', |
|
56 | + 'CRYPTO_SIGN_KEYPAIRBYTES', |
|
57 | + 'CRYPTO_STREAM_KEYBYTES', |
|
58 | + 'CRYPTO_STREAM_NONCEBYTES', |
|
59 | + ) as $constant |
|
60 | 60 | ) { |
61 | - if (!defined("SODIUM_$constant")) { |
|
62 | - define("SODIUM_$constant", constant("ParagonIE_Sodium_Compat::$constant")); |
|
63 | - } |
|
61 | + if (!defined("SODIUM_$constant")) { |
|
62 | + define("SODIUM_$constant", constant("ParagonIE_Sodium_Compat::$constant")); |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if (!is_callable('sodium_bin2hex')) { |
67 | - /** |
|
68 | - * @param string $string |
|
69 | - * @return string |
|
70 | - */ |
|
71 | - function sodium_bin2hex($string) |
|
72 | - { |
|
73 | - return ParagonIE_Sodium_Compat::bin2hex($string); |
|
74 | - } |
|
67 | + /** |
|
68 | + * @param string $string |
|
69 | + * @return string |
|
70 | + */ |
|
71 | + function sodium_bin2hex($string) |
|
72 | + { |
|
73 | + return ParagonIE_Sodium_Compat::bin2hex($string); |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | if (!is_callable('sodium_compare')) { |
77 | - /** |
|
78 | - * @param string $a |
|
79 | - * @param string $b |
|
80 | - * @return int |
|
81 | - */ |
|
82 | - function sodium_compare($a, $b) |
|
83 | - { |
|
84 | - return ParagonIE_Sodium_Compat::compare($a, $b); |
|
85 | - } |
|
77 | + /** |
|
78 | + * @param string $a |
|
79 | + * @param string $b |
|
80 | + * @return int |
|
81 | + */ |
|
82 | + function sodium_compare($a, $b) |
|
83 | + { |
|
84 | + return ParagonIE_Sodium_Compat::compare($a, $b); |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | if (!is_callable('sodium_crypto_aead_chacha20poly1305_decrypt')) { |
88 | - /** |
|
89 | - * @param string $message |
|
90 | - * @param string $assocData |
|
91 | - * @param string $nonce |
|
92 | - * @param string $key |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
96 | - { |
|
97 | - try { |
|
98 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
99 | - } catch (Error $ex) { |
|
100 | - return false; |
|
101 | - } catch (Exception $ex) { |
|
102 | - return false; |
|
103 | - } |
|
104 | - } |
|
88 | + /** |
|
89 | + * @param string $message |
|
90 | + * @param string $assocData |
|
91 | + * @param string $nonce |
|
92 | + * @param string $key |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
96 | + { |
|
97 | + try { |
|
98 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
99 | + } catch (Error $ex) { |
|
100 | + return false; |
|
101 | + } catch (Exception $ex) { |
|
102 | + return false; |
|
103 | + } |
|
104 | + } |
|
105 | 105 | } |
106 | 106 | if (!is_callable('sodium_crypto_aead_chacha20poly1305_encrypt')) { |
107 | - /** |
|
108 | - * @param string $message |
|
109 | - * @param string $assocData |
|
110 | - * @param string $nonce |
|
111 | - * @param string $key |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
115 | - { |
|
116 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
117 | - } |
|
107 | + /** |
|
108 | + * @param string $message |
|
109 | + * @param string $assocData |
|
110 | + * @param string $nonce |
|
111 | + * @param string $key |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
115 | + { |
|
116 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_decrypt')) { |
120 | - /** |
|
121 | - * @param string $message |
|
122 | - * @param string $assocData |
|
123 | - * @param string $nonce |
|
124 | - * @param string $key |
|
125 | - * @return string |
|
126 | - */ |
|
127 | - function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
128 | - { |
|
129 | - try { |
|
130 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
131 | - } catch (Error $ex) { |
|
132 | - return false; |
|
133 | - } catch (Exception $ex) { |
|
134 | - return false; |
|
135 | - } |
|
136 | - } |
|
120 | + /** |
|
121 | + * @param string $message |
|
122 | + * @param string $assocData |
|
123 | + * @param string $nonce |
|
124 | + * @param string $key |
|
125 | + * @return string |
|
126 | + */ |
|
127 | + function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
128 | + { |
|
129 | + try { |
|
130 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
131 | + } catch (Error $ex) { |
|
132 | + return false; |
|
133 | + } catch (Exception $ex) { |
|
134 | + return false; |
|
135 | + } |
|
136 | + } |
|
137 | 137 | } |
138 | 138 | if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_encrypt')) { |
139 | - /** |
|
140 | - * @param string $message |
|
141 | - * @param string $assocData |
|
142 | - * @param string $nonce |
|
143 | - * @param string $key |
|
144 | - * @return string |
|
145 | - */ |
|
146 | - function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
147 | - { |
|
148 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
149 | - } |
|
139 | + /** |
|
140 | + * @param string $message |
|
141 | + * @param string $assocData |
|
142 | + * @param string $nonce |
|
143 | + * @param string $key |
|
144 | + * @return string |
|
145 | + */ |
|
146 | + function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
147 | + { |
|
148 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
149 | + } |
|
150 | 150 | } |
151 | 151 | if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt')) { |
152 | - /** |
|
153 | - * @param string $message |
|
154 | - * @param string $assocData |
|
155 | - * @param string $nonce |
|
156 | - * @param string $key |
|
157 | - * @return string |
|
158 | - */ |
|
159 | - function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
160 | - { |
|
161 | - try { |
|
162 | - return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
163 | - } catch (Error $ex) { |
|
164 | - return false; |
|
165 | - } catch (Exception $ex) { |
|
166 | - return false; |
|
167 | - } |
|
168 | - } |
|
152 | + /** |
|
153 | + * @param string $message |
|
154 | + * @param string $assocData |
|
155 | + * @param string $nonce |
|
156 | + * @param string $key |
|
157 | + * @return string |
|
158 | + */ |
|
159 | + function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
160 | + { |
|
161 | + try { |
|
162 | + return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
163 | + } catch (Error $ex) { |
|
164 | + return false; |
|
165 | + } catch (Exception $ex) { |
|
166 | + return false; |
|
167 | + } |
|
168 | + } |
|
169 | 169 | } |
170 | 170 | if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')) { |
171 | - /** |
|
172 | - * @param string $message |
|
173 | - * @param string $assocData |
|
174 | - * @param string $nonce |
|
175 | - * @param string $key |
|
176 | - * @return string |
|
177 | - */ |
|
178 | - function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
179 | - { |
|
180 | - return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
181 | - } |
|
171 | + /** |
|
172 | + * @param string $message |
|
173 | + * @param string $assocData |
|
174 | + * @param string $nonce |
|
175 | + * @param string $key |
|
176 | + * @return string |
|
177 | + */ |
|
178 | + function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
179 | + { |
|
180 | + return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
181 | + } |
|
182 | 182 | } |
183 | 183 | if (!is_callable('sodium_crypto_auth')) { |
184 | - /** |
|
185 | - * @param string $message |
|
186 | - * @param string $key |
|
187 | - * @return string |
|
188 | - */ |
|
189 | - function sodium_crypto_auth($message, $key) |
|
190 | - { |
|
191 | - return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
192 | - } |
|
184 | + /** |
|
185 | + * @param string $message |
|
186 | + * @param string $key |
|
187 | + * @return string |
|
188 | + */ |
|
189 | + function sodium_crypto_auth($message, $key) |
|
190 | + { |
|
191 | + return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
192 | + } |
|
193 | 193 | } |
194 | 194 | if (!is_callable('sodium_crypto_auth_verify')) { |
195 | - /** |
|
196 | - * @param string $mac |
|
197 | - * @param string $message |
|
198 | - * @param string $key |
|
199 | - * @return bool |
|
200 | - */ |
|
201 | - function sodium_crypto_auth_verify($mac, $message, $key) |
|
202 | - { |
|
203 | - return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
204 | - } |
|
195 | + /** |
|
196 | + * @param string $mac |
|
197 | + * @param string $message |
|
198 | + * @param string $key |
|
199 | + * @return bool |
|
200 | + */ |
|
201 | + function sodium_crypto_auth_verify($mac, $message, $key) |
|
202 | + { |
|
203 | + return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
204 | + } |
|
205 | 205 | } |
206 | 206 | if (!is_callable('sodium_crypto_box')) { |
207 | - /** |
|
208 | - * @param string $message |
|
209 | - * @param string $nonce |
|
210 | - * @param string $kp |
|
211 | - * @return string |
|
212 | - */ |
|
213 | - function sodium_crypto_box($message, $nonce, $kp) |
|
214 | - { |
|
215 | - return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
216 | - } |
|
207 | + /** |
|
208 | + * @param string $message |
|
209 | + * @param string $nonce |
|
210 | + * @param string $kp |
|
211 | + * @return string |
|
212 | + */ |
|
213 | + function sodium_crypto_box($message, $nonce, $kp) |
|
214 | + { |
|
215 | + return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
216 | + } |
|
217 | 217 | } |
218 | 218 | if (!is_callable('sodium_crypto_box_keypair')) { |
219 | - /** |
|
220 | - * @return string |
|
221 | - */ |
|
222 | - function sodium_crypto_box_keypair() |
|
223 | - { |
|
224 | - return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
|
225 | - } |
|
219 | + /** |
|
220 | + * @return string |
|
221 | + */ |
|
222 | + function sodium_crypto_box_keypair() |
|
223 | + { |
|
224 | + return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
|
225 | + } |
|
226 | 226 | } |
227 | 227 | if (!is_callable('sodium_crypto_box_keypair_from_secretkey_and_publickey')) { |
228 | - /** |
|
229 | - * @param string $sk |
|
230 | - * @param string $pk |
|
231 | - * @return string |
|
232 | - */ |
|
233 | - function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
234 | - { |
|
235 | - return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
236 | - } |
|
228 | + /** |
|
229 | + * @param string $sk |
|
230 | + * @param string $pk |
|
231 | + * @return string |
|
232 | + */ |
|
233 | + function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
234 | + { |
|
235 | + return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
236 | + } |
|
237 | 237 | } |
238 | 238 | if (!is_callable('sodium_crypto_box_open')) { |
239 | - /** |
|
240 | - * @param string $message |
|
241 | - * @param string $nonce |
|
242 | - * @param string $kp |
|
243 | - * @return string|bool |
|
244 | - */ |
|
245 | - function sodium_crypto_box_open($message, $nonce, $kp) |
|
246 | - { |
|
247 | - try { |
|
248 | - return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
249 | - } catch (Error $ex) { |
|
250 | - return false; |
|
251 | - } catch (Exception $ex) { |
|
252 | - return false; |
|
253 | - } |
|
254 | - } |
|
239 | + /** |
|
240 | + * @param string $message |
|
241 | + * @param string $nonce |
|
242 | + * @param string $kp |
|
243 | + * @return string|bool |
|
244 | + */ |
|
245 | + function sodium_crypto_box_open($message, $nonce, $kp) |
|
246 | + { |
|
247 | + try { |
|
248 | + return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
249 | + } catch (Error $ex) { |
|
250 | + return false; |
|
251 | + } catch (Exception $ex) { |
|
252 | + return false; |
|
253 | + } |
|
254 | + } |
|
255 | 255 | } |
256 | 256 | if (!is_callable('sodium_crypto_box_publickey')) { |
257 | - /** |
|
258 | - * @param string $keypair |
|
259 | - * @return string |
|
260 | - */ |
|
261 | - function sodium_crypto_box_publickey($keypair) |
|
262 | - { |
|
263 | - return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
264 | - } |
|
257 | + /** |
|
258 | + * @param string $keypair |
|
259 | + * @return string |
|
260 | + */ |
|
261 | + function sodium_crypto_box_publickey($keypair) |
|
262 | + { |
|
263 | + return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
264 | + } |
|
265 | 265 | } |
266 | 266 | if (!is_callable('sodium_crypto_box_publickey_from_secretkey')) { |
267 | - /** |
|
268 | - * @param string $sk |
|
269 | - * @return string |
|
270 | - */ |
|
271 | - function sodium_crypto_box_publickey_from_secretkey($sk) |
|
272 | - { |
|
273 | - return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
274 | - } |
|
267 | + /** |
|
268 | + * @param string $sk |
|
269 | + * @return string |
|
270 | + */ |
|
271 | + function sodium_crypto_box_publickey_from_secretkey($sk) |
|
272 | + { |
|
273 | + return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
274 | + } |
|
275 | 275 | } |
276 | 276 | if (!is_callable('sodium_crypto_box_seal')) { |
277 | - /** |
|
278 | - * @param string $message |
|
279 | - * @param string $publicKey |
|
280 | - * @return string |
|
281 | - */ |
|
282 | - function sodium_crypto_box_seal($message, $publicKey) |
|
283 | - { |
|
284 | - return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
285 | - } |
|
277 | + /** |
|
278 | + * @param string $message |
|
279 | + * @param string $publicKey |
|
280 | + * @return string |
|
281 | + */ |
|
282 | + function sodium_crypto_box_seal($message, $publicKey) |
|
283 | + { |
|
284 | + return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
285 | + } |
|
286 | 286 | } |
287 | 287 | if (!is_callable('sodium_crypto_box_seal_open')) { |
288 | - /** |
|
289 | - * @param string $message |
|
290 | - * @param string $kp |
|
291 | - * @return string|bool |
|
292 | - */ |
|
293 | - function sodium_crypto_box_seal_open($message, $kp) |
|
294 | - { |
|
295 | - try { |
|
296 | - return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
297 | - } catch (Error $ex) { |
|
298 | - return false; |
|
299 | - } catch (Exception $ex) { |
|
300 | - return false; |
|
301 | - } |
|
302 | - } |
|
288 | + /** |
|
289 | + * @param string $message |
|
290 | + * @param string $kp |
|
291 | + * @return string|bool |
|
292 | + */ |
|
293 | + function sodium_crypto_box_seal_open($message, $kp) |
|
294 | + { |
|
295 | + try { |
|
296 | + return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
297 | + } catch (Error $ex) { |
|
298 | + return false; |
|
299 | + } catch (Exception $ex) { |
|
300 | + return false; |
|
301 | + } |
|
302 | + } |
|
303 | 303 | } |
304 | 304 | if (!is_callable('sodium_crypto_box_secretkey')) { |
305 | - /** |
|
306 | - * @param string $keypair |
|
307 | - * @return string |
|
308 | - */ |
|
309 | - function sodium_crypto_box_secretkey($keypair) |
|
310 | - { |
|
311 | - return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
312 | - } |
|
305 | + /** |
|
306 | + * @param string $keypair |
|
307 | + * @return string |
|
308 | + */ |
|
309 | + function sodium_crypto_box_secretkey($keypair) |
|
310 | + { |
|
311 | + return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
312 | + } |
|
313 | 313 | } |
314 | 314 | if (!is_callable('sodium_crypto_box_seed_keypair')) { |
315 | - /** |
|
316 | - * @param string $seed |
|
317 | - * @return string |
|
318 | - */ |
|
319 | - function sodium_crypto_box_seed_keypair($seed) |
|
320 | - { |
|
321 | - return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); |
|
322 | - } |
|
315 | + /** |
|
316 | + * @param string $seed |
|
317 | + * @return string |
|
318 | + */ |
|
319 | + function sodium_crypto_box_seed_keypair($seed) |
|
320 | + { |
|
321 | + return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); |
|
322 | + } |
|
323 | 323 | } |
324 | 324 | if (!is_callable('sodium_crypto_generichash')) { |
325 | - /** |
|
326 | - * @param string $message |
|
327 | - * @param string|null $key |
|
328 | - * @param int $outLen |
|
329 | - * @return string |
|
330 | - */ |
|
331 | - function sodium_crypto_generichash($message, $key = null, $outLen = 32) |
|
332 | - { |
|
333 | - return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
334 | - } |
|
325 | + /** |
|
326 | + * @param string $message |
|
327 | + * @param string|null $key |
|
328 | + * @param int $outLen |
|
329 | + * @return string |
|
330 | + */ |
|
331 | + function sodium_crypto_generichash($message, $key = null, $outLen = 32) |
|
332 | + { |
|
333 | + return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
334 | + } |
|
335 | 335 | } |
336 | 336 | if (!is_callable('sodium_crypto_generichash_final')) { |
337 | - /** |
|
338 | - * @param string|null $ctx |
|
339 | - * @param int $outputLength |
|
340 | - * @return string |
|
341 | - */ |
|
342 | - function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) |
|
343 | - { |
|
344 | - return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
345 | - } |
|
337 | + /** |
|
338 | + * @param string|null $ctx |
|
339 | + * @param int $outputLength |
|
340 | + * @return string |
|
341 | + */ |
|
342 | + function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) |
|
343 | + { |
|
344 | + return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
345 | + } |
|
346 | 346 | } |
347 | 347 | if (!is_callable('sodium_crypto_generichash_init')) { |
348 | - /** |
|
349 | - * @param string|null $key |
|
350 | - * @param int $outLen |
|
351 | - * @return string |
|
352 | - */ |
|
353 | - function sodium_crypto_generichash_init($key = null, $outLen = 32) |
|
354 | - { |
|
355 | - return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
356 | - } |
|
348 | + /** |
|
349 | + * @param string|null $key |
|
350 | + * @param int $outLen |
|
351 | + * @return string |
|
352 | + */ |
|
353 | + function sodium_crypto_generichash_init($key = null, $outLen = 32) |
|
354 | + { |
|
355 | + return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
356 | + } |
|
357 | 357 | } |
358 | 358 | if (!is_callable('sodium_crypto_generichash_update')) { |
359 | - /** |
|
360 | - * @param string|null $ctx |
|
361 | - * @param string $message |
|
362 | - * @return void |
|
363 | - */ |
|
364 | - function sodium_crypto_generichash_update(&$ctx, $message = '') |
|
365 | - { |
|
366 | - ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
367 | - } |
|
359 | + /** |
|
360 | + * @param string|null $ctx |
|
361 | + * @param string $message |
|
362 | + * @return void |
|
363 | + */ |
|
364 | + function sodium_crypto_generichash_update(&$ctx, $message = '') |
|
365 | + { |
|
366 | + ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
367 | + } |
|
368 | 368 | } |
369 | 369 | if (!is_callable('sodium_crypto_kx')) { |
370 | - /** |
|
371 | - * @param string $my_secret |
|
372 | - * @param string $their_public |
|
373 | - * @param string $client_public |
|
374 | - * @param string $server_public |
|
375 | - * @return string |
|
376 | - */ |
|
377 | - function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
378 | - { |
|
379 | - return ParagonIE_Sodium_Compat::crypto_kx( |
|
380 | - $my_secret, |
|
381 | - $their_public, |
|
382 | - $client_public, |
|
383 | - $server_public |
|
384 | - ); |
|
385 | - } |
|
370 | + /** |
|
371 | + * @param string $my_secret |
|
372 | + * @param string $their_public |
|
373 | + * @param string $client_public |
|
374 | + * @param string $server_public |
|
375 | + * @return string |
|
376 | + */ |
|
377 | + function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
378 | + { |
|
379 | + return ParagonIE_Sodium_Compat::crypto_kx( |
|
380 | + $my_secret, |
|
381 | + $their_public, |
|
382 | + $client_public, |
|
383 | + $server_public |
|
384 | + ); |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | if (!is_callable('sodium_crypto_pwhash')) { |
388 | - /** |
|
389 | - * @param int $outlen |
|
390 | - * @param string $passwd |
|
391 | - * @param string $salt |
|
392 | - * @param int $opslimit |
|
393 | - * @param int $memlimit |
|
394 | - * @return string |
|
395 | - */ |
|
396 | - function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
397 | - { |
|
398 | - return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
399 | - } |
|
388 | + /** |
|
389 | + * @param int $outlen |
|
390 | + * @param string $passwd |
|
391 | + * @param string $salt |
|
392 | + * @param int $opslimit |
|
393 | + * @param int $memlimit |
|
394 | + * @return string |
|
395 | + */ |
|
396 | + function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
397 | + { |
|
398 | + return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
399 | + } |
|
400 | 400 | } |
401 | 401 | if (!is_callable('sodium_crypto_pwhash_str')) { |
402 | - /** |
|
403 | - * @param string $passwd |
|
404 | - * @param int $opslimit |
|
405 | - * @param int $memlimit |
|
406 | - * @return string |
|
407 | - */ |
|
408 | - function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
409 | - { |
|
410 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
411 | - } |
|
402 | + /** |
|
403 | + * @param string $passwd |
|
404 | + * @param int $opslimit |
|
405 | + * @param int $memlimit |
|
406 | + * @return string |
|
407 | + */ |
|
408 | + function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
409 | + { |
|
410 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
411 | + } |
|
412 | 412 | } |
413 | 413 | if (!is_callable('sodium_crypto_pwhash_str_verify')) { |
414 | - /** |
|
415 | - * @param string $passwd |
|
416 | - * @param string $hash |
|
417 | - * @return bool |
|
418 | - */ |
|
419 | - function sodium_crypto_pwhash_str_verify($passwd, $hash) |
|
420 | - { |
|
421 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
422 | - } |
|
414 | + /** |
|
415 | + * @param string $passwd |
|
416 | + * @param string $hash |
|
417 | + * @return bool |
|
418 | + */ |
|
419 | + function sodium_crypto_pwhash_str_verify($passwd, $hash) |
|
420 | + { |
|
421 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
422 | + } |
|
423 | 423 | } |
424 | 424 | if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256')) { |
425 | - /** |
|
426 | - * @param int $outlen |
|
427 | - * @param string $passwd |
|
428 | - * @param string $salt |
|
429 | - * @param int $opslimit |
|
430 | - * @param int $memlimit |
|
431 | - * @return string |
|
432 | - */ |
|
433 | - function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
434 | - { |
|
435 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
436 | - } |
|
425 | + /** |
|
426 | + * @param int $outlen |
|
427 | + * @param string $passwd |
|
428 | + * @param string $salt |
|
429 | + * @param int $opslimit |
|
430 | + * @param int $memlimit |
|
431 | + * @return string |
|
432 | + */ |
|
433 | + function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
434 | + { |
|
435 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
436 | + } |
|
437 | 437 | } |
438 | 438 | if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str')) { |
439 | - /** |
|
440 | - * @param string $passwd |
|
441 | - * @param int $opslimit |
|
442 | - * @param int $memlimit |
|
443 | - * @return string |
|
444 | - */ |
|
445 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
446 | - { |
|
447 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
448 | - } |
|
439 | + /** |
|
440 | + * @param string $passwd |
|
441 | + * @param int $opslimit |
|
442 | + * @param int $memlimit |
|
443 | + * @return string |
|
444 | + */ |
|
445 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
446 | + { |
|
447 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
448 | + } |
|
449 | 449 | } |
450 | 450 | if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str_verify')) { |
451 | - /** |
|
452 | - * @param string $passwd |
|
453 | - * @param string $hash |
|
454 | - * @return bool |
|
455 | - */ |
|
456 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
457 | - { |
|
458 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
459 | - } |
|
451 | + /** |
|
452 | + * @param string $passwd |
|
453 | + * @param string $hash |
|
454 | + * @return bool |
|
455 | + */ |
|
456 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
457 | + { |
|
458 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
459 | + } |
|
460 | 460 | } |
461 | 461 | if (!is_callable('sodium_crypto_scalarmult')) { |
462 | - /** |
|
463 | - * @param string $n |
|
464 | - * @param string $p |
|
465 | - * @return string |
|
466 | - */ |
|
467 | - function sodium_crypto_scalarmult($n, $p) |
|
468 | - { |
|
469 | - return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
470 | - } |
|
462 | + /** |
|
463 | + * @param string $n |
|
464 | + * @param string $p |
|
465 | + * @return string |
|
466 | + */ |
|
467 | + function sodium_crypto_scalarmult($n, $p) |
|
468 | + { |
|
469 | + return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
470 | + } |
|
471 | 471 | } |
472 | 472 | if (!is_callable('sodium_crypto_scalarmult_base')) { |
473 | - /** |
|
474 | - * @param string $n |
|
475 | - * @return string |
|
476 | - */ |
|
477 | - function sodium_crypto_scalarmult_base($n) |
|
478 | - { |
|
479 | - return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
480 | - } |
|
473 | + /** |
|
474 | + * @param string $n |
|
475 | + * @return string |
|
476 | + */ |
|
477 | + function sodium_crypto_scalarmult_base($n) |
|
478 | + { |
|
479 | + return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
480 | + } |
|
481 | 481 | } |
482 | 482 | if (!is_callable('sodium_crypto_secretbox')) { |
483 | - /** |
|
484 | - * @param string $message |
|
485 | - * @param string $nonce |
|
486 | - * @param string $key |
|
487 | - * @return string |
|
488 | - */ |
|
489 | - function sodium_crypto_secretbox($message, $nonce, $key) |
|
490 | - { |
|
491 | - return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
492 | - } |
|
483 | + /** |
|
484 | + * @param string $message |
|
485 | + * @param string $nonce |
|
486 | + * @param string $key |
|
487 | + * @return string |
|
488 | + */ |
|
489 | + function sodium_crypto_secretbox($message, $nonce, $key) |
|
490 | + { |
|
491 | + return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
492 | + } |
|
493 | 493 | } |
494 | 494 | if (!is_callable('sodium_crypto_secretbox_open')) { |
495 | - /** |
|
496 | - * @param string $message |
|
497 | - * @param string $nonce |
|
498 | - * @param string $key |
|
499 | - * @return string|bool |
|
500 | - */ |
|
501 | - function sodium_crypto_secretbox_open($message, $nonce, $key) |
|
502 | - { |
|
503 | - try { |
|
504 | - return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
505 | - } catch (Error $ex) { |
|
506 | - return false; |
|
507 | - } catch (Exception $ex) { |
|
508 | - return false; |
|
509 | - } |
|
510 | - } |
|
495 | + /** |
|
496 | + * @param string $message |
|
497 | + * @param string $nonce |
|
498 | + * @param string $key |
|
499 | + * @return string|bool |
|
500 | + */ |
|
501 | + function sodium_crypto_secretbox_open($message, $nonce, $key) |
|
502 | + { |
|
503 | + try { |
|
504 | + return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
505 | + } catch (Error $ex) { |
|
506 | + return false; |
|
507 | + } catch (Exception $ex) { |
|
508 | + return false; |
|
509 | + } |
|
510 | + } |
|
511 | 511 | } |
512 | 512 | if (!is_callable('sodium_crypto_shorthash')) { |
513 | - /** |
|
514 | - * @param string $message |
|
515 | - * @param string $key |
|
516 | - * @return string |
|
517 | - */ |
|
518 | - function sodium_crypto_shorthash($message, $key = '') |
|
519 | - { |
|
520 | - return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
521 | - } |
|
513 | + /** |
|
514 | + * @param string $message |
|
515 | + * @param string $key |
|
516 | + * @return string |
|
517 | + */ |
|
518 | + function sodium_crypto_shorthash($message, $key = '') |
|
519 | + { |
|
520 | + return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
521 | + } |
|
522 | 522 | } |
523 | 523 | if (!is_callable('sodium_crypto_sign')) { |
524 | - /** |
|
525 | - * @param string $message |
|
526 | - * @param string $sk |
|
527 | - * @return string |
|
528 | - */ |
|
529 | - function sodium_crypto_sign($message, $sk) |
|
530 | - { |
|
531 | - return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
532 | - } |
|
524 | + /** |
|
525 | + * @param string $message |
|
526 | + * @param string $sk |
|
527 | + * @return string |
|
528 | + */ |
|
529 | + function sodium_crypto_sign($message, $sk) |
|
530 | + { |
|
531 | + return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
532 | + } |
|
533 | 533 | } |
534 | 534 | if (!is_callable('sodium_crypto_sign_detached')) { |
535 | - /** |
|
536 | - * @param string $message |
|
537 | - * @param string $sk |
|
538 | - * @return string |
|
539 | - */ |
|
540 | - function sodium_crypto_sign_detached($message, $sk) |
|
541 | - { |
|
542 | - return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
543 | - } |
|
535 | + /** |
|
536 | + * @param string $message |
|
537 | + * @param string $sk |
|
538 | + * @return string |
|
539 | + */ |
|
540 | + function sodium_crypto_sign_detached($message, $sk) |
|
541 | + { |
|
542 | + return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
543 | + } |
|
544 | 544 | } |
545 | 545 | if (!is_callable('sodium_crypto_sign_keypair')) { |
546 | - /** |
|
547 | - * @return string |
|
548 | - */ |
|
549 | - function sodium_crypto_sign_keypair() |
|
550 | - { |
|
551 | - return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
|
552 | - } |
|
546 | + /** |
|
547 | + * @return string |
|
548 | + */ |
|
549 | + function sodium_crypto_sign_keypair() |
|
550 | + { |
|
551 | + return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
|
552 | + } |
|
553 | 553 | } |
554 | 554 | if (!is_callable('sodium_crypto_sign_open')) { |
555 | - /** |
|
556 | - * @param string $signedMessage |
|
557 | - * @param string $pk |
|
558 | - * @return string|bool |
|
559 | - */ |
|
560 | - function sodium_crypto_sign_open($signedMessage, $pk) |
|
561 | - { |
|
562 | - try { |
|
563 | - return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
564 | - } catch (Error $ex) { |
|
565 | - return false; |
|
566 | - } catch (Exception $ex) { |
|
567 | - return false; |
|
568 | - } |
|
569 | - } |
|
555 | + /** |
|
556 | + * @param string $signedMessage |
|
557 | + * @param string $pk |
|
558 | + * @return string|bool |
|
559 | + */ |
|
560 | + function sodium_crypto_sign_open($signedMessage, $pk) |
|
561 | + { |
|
562 | + try { |
|
563 | + return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
564 | + } catch (Error $ex) { |
|
565 | + return false; |
|
566 | + } catch (Exception $ex) { |
|
567 | + return false; |
|
568 | + } |
|
569 | + } |
|
570 | 570 | } |
571 | 571 | if (!is_callable('sodium_crypto_sign_publickey')) { |
572 | - /** |
|
573 | - * @param string $keypair |
|
574 | - * @return string |
|
575 | - */ |
|
576 | - function sodium_crypto_sign_publickey($keypair) |
|
577 | - { |
|
578 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
579 | - } |
|
572 | + /** |
|
573 | + * @param string $keypair |
|
574 | + * @return string |
|
575 | + */ |
|
576 | + function sodium_crypto_sign_publickey($keypair) |
|
577 | + { |
|
578 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
579 | + } |
|
580 | 580 | } |
581 | 581 | if (!is_callable('sodium_crypto_sign_publickey_from_secretkey')) { |
582 | - /** |
|
583 | - * @param string $sk |
|
584 | - * @return string |
|
585 | - */ |
|
586 | - function sodium_crypto_sign_publickey_from_secretkey($sk) |
|
587 | - { |
|
588 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
589 | - } |
|
582 | + /** |
|
583 | + * @param string $sk |
|
584 | + * @return string |
|
585 | + */ |
|
586 | + function sodium_crypto_sign_publickey_from_secretkey($sk) |
|
587 | + { |
|
588 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
589 | + } |
|
590 | 590 | } |
591 | 591 | if (!is_callable('sodium_crypto_sign_secretkey')) { |
592 | - /** |
|
593 | - * @param string $keypair |
|
594 | - * @return string |
|
595 | - */ |
|
596 | - function sodium_crypto_sign_secretkey($keypair) |
|
597 | - { |
|
598 | - return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
599 | - } |
|
592 | + /** |
|
593 | + * @param string $keypair |
|
594 | + * @return string |
|
595 | + */ |
|
596 | + function sodium_crypto_sign_secretkey($keypair) |
|
597 | + { |
|
598 | + return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
599 | + } |
|
600 | 600 | } |
601 | 601 | if (!is_callable('sodium_crypto_sign_seed_keypair')) { |
602 | - /** |
|
603 | - * @param string $seed |
|
604 | - * @return string |
|
605 | - */ |
|
606 | - function sodium_crypto_sign_seed_keypair($seed) |
|
607 | - { |
|
608 | - return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
609 | - } |
|
602 | + /** |
|
603 | + * @param string $seed |
|
604 | + * @return string |
|
605 | + */ |
|
606 | + function sodium_crypto_sign_seed_keypair($seed) |
|
607 | + { |
|
608 | + return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
609 | + } |
|
610 | 610 | } |
611 | 611 | if (!is_callable('sodium_crypto_sign_verify_detached')) { |
612 | - /** |
|
613 | - * @param string $signature |
|
614 | - * @param string $message |
|
615 | - * @param string $pk |
|
616 | - * @return bool |
|
617 | - */ |
|
618 | - function sodium_crypto_sign_verify_detached($signature, $message, $pk) |
|
619 | - { |
|
620 | - return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
621 | - } |
|
612 | + /** |
|
613 | + * @param string $signature |
|
614 | + * @param string $message |
|
615 | + * @param string $pk |
|
616 | + * @return bool |
|
617 | + */ |
|
618 | + function sodium_crypto_sign_verify_detached($signature, $message, $pk) |
|
619 | + { |
|
620 | + return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
621 | + } |
|
622 | 622 | } |
623 | 623 | if (!is_callable('sodium_crypto_stream')) { |
624 | - /** |
|
625 | - * @param int $len |
|
626 | - * @param string $nonce |
|
627 | - * @param string $key |
|
628 | - * @return string |
|
629 | - */ |
|
630 | - function sodium_crypto_stream($len, $nonce, $key) |
|
631 | - { |
|
632 | - return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
633 | - } |
|
624 | + /** |
|
625 | + * @param int $len |
|
626 | + * @param string $nonce |
|
627 | + * @param string $key |
|
628 | + * @return string |
|
629 | + */ |
|
630 | + function sodium_crypto_stream($len, $nonce, $key) |
|
631 | + { |
|
632 | + return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
633 | + } |
|
634 | 634 | } |
635 | 635 | if (!is_callable('sodium_crypto_stream_xor')) { |
636 | - /** |
|
637 | - * @param string $message |
|
638 | - * @param string $nonce |
|
639 | - * @param string $key |
|
640 | - * @return string |
|
641 | - */ |
|
642 | - function sodium_crypto_stream_xor($message, $nonce, $key) |
|
643 | - { |
|
644 | - return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
645 | - } |
|
636 | + /** |
|
637 | + * @param string $message |
|
638 | + * @param string $nonce |
|
639 | + * @param string $key |
|
640 | + * @return string |
|
641 | + */ |
|
642 | + function sodium_crypto_stream_xor($message, $nonce, $key) |
|
643 | + { |
|
644 | + return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
645 | + } |
|
646 | 646 | } |
647 | 647 | if (!is_callable('sodium_hex2bin')) { |
648 | - /** |
|
649 | - * @param string $string |
|
650 | - * @return string |
|
651 | - */ |
|
652 | - function sodium_hex2bin($string) |
|
653 | - { |
|
654 | - return ParagonIE_Sodium_Compat::hex2bin($string); |
|
655 | - } |
|
648 | + /** |
|
649 | + * @param string $string |
|
650 | + * @return string |
|
651 | + */ |
|
652 | + function sodium_hex2bin($string) |
|
653 | + { |
|
654 | + return ParagonIE_Sodium_Compat::hex2bin($string); |
|
655 | + } |
|
656 | 656 | } |
657 | 657 | if (!is_callable('sodium_increment')) { |
658 | - /** |
|
659 | - * @param &string $string |
|
660 | - * @return void |
|
661 | - */ |
|
662 | - function sodium_increment(&$string) |
|
663 | - { |
|
664 | - ParagonIE_Sodium_Compat::increment($string); |
|
665 | - } |
|
658 | + /** |
|
659 | + * @param &string $string |
|
660 | + * @return void |
|
661 | + */ |
|
662 | + function sodium_increment(&$string) |
|
663 | + { |
|
664 | + ParagonIE_Sodium_Compat::increment($string); |
|
665 | + } |
|
666 | 666 | } |
667 | 667 | if (!is_callable('sodium_library_version_major')) { |
668 | - /** |
|
669 | - * @return int |
|
670 | - */ |
|
671 | - function sodium_library_version_major() |
|
672 | - { |
|
673 | - return ParagonIE_Sodium_Compat::library_version_major(); |
|
674 | - } |
|
668 | + /** |
|
669 | + * @return int |
|
670 | + */ |
|
671 | + function sodium_library_version_major() |
|
672 | + { |
|
673 | + return ParagonIE_Sodium_Compat::library_version_major(); |
|
674 | + } |
|
675 | 675 | } |
676 | 676 | if (!is_callable('sodium_library_version_minor')) { |
677 | - /** |
|
678 | - * @return int |
|
679 | - */ |
|
680 | - function sodium_library_version_minor() |
|
681 | - { |
|
682 | - return ParagonIE_Sodium_Compat::library_version_minor(); |
|
683 | - } |
|
677 | + /** |
|
678 | + * @return int |
|
679 | + */ |
|
680 | + function sodium_library_version_minor() |
|
681 | + { |
|
682 | + return ParagonIE_Sodium_Compat::library_version_minor(); |
|
683 | + } |
|
684 | 684 | } |
685 | 685 | if (!is_callable('sodium_version_string')) { |
686 | - /** |
|
687 | - * @return string |
|
688 | - */ |
|
689 | - function sodium_version_string() |
|
690 | - { |
|
691 | - return ParagonIE_Sodium_Compat::version_string(); |
|
692 | - } |
|
686 | + /** |
|
687 | + * @return string |
|
688 | + */ |
|
689 | + function sodium_version_string() |
|
690 | + { |
|
691 | + return ParagonIE_Sodium_Compat::version_string(); |
|
692 | + } |
|
693 | 693 | } |
694 | 694 | if (!is_callable('sodium_memcmp')) { |
695 | - /** |
|
696 | - * @param string $a |
|
697 | - * @param string $b |
|
698 | - * @return int |
|
699 | - */ |
|
700 | - function sodium_memcmp($a, $b) |
|
701 | - { |
|
702 | - return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
703 | - } |
|
695 | + /** |
|
696 | + * @param string $a |
|
697 | + * @param string $b |
|
698 | + * @return int |
|
699 | + */ |
|
700 | + function sodium_memcmp($a, $b) |
|
701 | + { |
|
702 | + return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
703 | + } |
|
704 | 704 | } |
705 | 705 | if (!is_callable('sodium_memzero')) { |
706 | - /** |
|
707 | - * @param string &$str |
|
708 | - * @return void |
|
709 | - */ |
|
710 | - function sodium_memzero(&$str) |
|
711 | - { |
|
712 | - ParagonIE_Sodium_Compat::memzero($str); |
|
713 | - } |
|
706 | + /** |
|
707 | + * @param string &$str |
|
708 | + * @return void |
|
709 | + */ |
|
710 | + function sodium_memzero(&$str) |
|
711 | + { |
|
712 | + ParagonIE_Sodium_Compat::memzero($str); |
|
713 | + } |
|
714 | 714 | } |
715 | 715 | if (!is_callable('sodium_randombytes_buf')) { |
716 | - /** |
|
717 | - * @param int $amount |
|
718 | - * @return string |
|
719 | - */ |
|
720 | - function sodium_randombytes_buf($amount) |
|
721 | - { |
|
722 | - return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
723 | - } |
|
716 | + /** |
|
717 | + * @param int $amount |
|
718 | + * @return string |
|
719 | + */ |
|
720 | + function sodium_randombytes_buf($amount) |
|
721 | + { |
|
722 | + return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
723 | + } |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | if (!is_callable('sodium_randombytes_uniform')) { |
727 | - /** |
|
728 | - * @param int $upperLimit |
|
729 | - * @return int |
|
730 | - */ |
|
731 | - function sodium_randombytes_uniform($upperLimit) |
|
732 | - { |
|
733 | - return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
734 | - } |
|
727 | + /** |
|
728 | + * @param int $upperLimit |
|
729 | + * @return int |
|
730 | + */ |
|
731 | + function sodium_randombytes_uniform($upperLimit) |
|
732 | + { |
|
733 | + return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
734 | + } |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | if (!is_callable('sodium_randombytes_random16')) { |
738 | - /** |
|
739 | - * @return int |
|
740 | - */ |
|
741 | - function sodium_randombytes_random16() |
|
742 | - { |
|
743 | - return ParagonIE_Sodium_Compat::randombytes_random16(); |
|
744 | - } |
|
738 | + /** |
|
739 | + * @return int |
|
740 | + */ |
|
741 | + function sodium_randombytes_random16() |
|
742 | + { |
|
743 | + return ParagonIE_Sodium_Compat::randombytes_random16(); |
|
744 | + } |
|
745 | 745 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * Thus, the functions or constants just proxy to the appropriate |
8 | 8 | * ParagonIE_Sodium_Compat method or class constant, respectively. |
9 | 9 | */ |
10 | -foreach (array( |
|
10 | +foreach ( array( |
|
11 | 11 | 'CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES', |
12 | 12 | 'CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES', |
13 | 13 | 'CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES', |
@@ -58,33 +58,33 @@ discard block |
||
58 | 58 | 'CRYPTO_STREAM_NONCEBYTES', |
59 | 59 | ) as $constant |
60 | 60 | ) { |
61 | - if (!defined("SODIUM_$constant")) { |
|
62 | - define("SODIUM_$constant", constant("ParagonIE_Sodium_Compat::$constant")); |
|
61 | + if ( ! defined( "SODIUM_$constant" ) ) { |
|
62 | + define( "SODIUM_$constant", constant( "ParagonIE_Sodium_Compat::$constant" ) ); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -if (!is_callable('sodium_bin2hex')) { |
|
66 | +if ( ! is_callable( 'sodium_bin2hex' ) ) { |
|
67 | 67 | /** |
68 | 68 | * @param string $string |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - function sodium_bin2hex($string) |
|
71 | + function sodium_bin2hex( $string ) |
|
72 | 72 | { |
73 | - return ParagonIE_Sodium_Compat::bin2hex($string); |
|
73 | + return ParagonIE_Sodium_Compat::bin2hex( $string ); |
|
74 | 74 | } |
75 | 75 | } |
76 | -if (!is_callable('sodium_compare')) { |
|
76 | +if ( ! is_callable( 'sodium_compare' ) ) { |
|
77 | 77 | /** |
78 | 78 | * @param string $a |
79 | 79 | * @param string $b |
80 | 80 | * @return int |
81 | 81 | */ |
82 | - function sodium_compare($a, $b) |
|
82 | + function sodium_compare( $a, $b ) |
|
83 | 83 | { |
84 | - return ParagonIE_Sodium_Compat::compare($a, $b); |
|
84 | + return ParagonIE_Sodium_Compat::compare( $a, $b ); |
|
85 | 85 | } |
86 | 86 | } |
87 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_decrypt')) { |
|
87 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_decrypt' ) ) { |
|
88 | 88 | /** |
89 | 89 | * @param string $message |
90 | 90 | * @param string $assocData |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | * @param string $key |
93 | 93 | * @return string |
94 | 94 | */ |
95 | - function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
95 | + function sodium_crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ) |
|
96 | 96 | { |
97 | 97 | try { |
98 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
99 | - } catch (Error $ex) { |
|
98 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ); |
|
99 | + } catch ( Error $ex ) { |
|
100 | 100 | return false; |
101 | - } catch (Exception $ex) { |
|
101 | + } catch ( Exception $ex ) { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_encrypt')) { |
|
106 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_encrypt' ) ) { |
|
107 | 107 | /** |
108 | 108 | * @param string $message |
109 | 109 | * @param string $assocData |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | * @param string $key |
112 | 112 | * @return string |
113 | 113 | */ |
114 | - function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
114 | + function sodium_crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ) |
|
115 | 115 | { |
116 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
116 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ); |
|
117 | 117 | } |
118 | 118 | } |
119 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_decrypt')) { |
|
119 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' ) ) { |
|
120 | 120 | /** |
121 | 121 | * @param string $message |
122 | 122 | * @param string $assocData |
@@ -124,18 +124,18 @@ discard block |
||
124 | 124 | * @param string $key |
125 | 125 | * @return string |
126 | 126 | */ |
127 | - function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
127 | + function sodium_crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ) |
|
128 | 128 | { |
129 | 129 | try { |
130 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
131 | - } catch (Error $ex) { |
|
130 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ); |
|
131 | + } catch ( Error $ex ) { |
|
132 | 132 | return false; |
133 | - } catch (Exception $ex) { |
|
133 | + } catch ( Exception $ex ) { |
|
134 | 134 | return false; |
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_encrypt')) { |
|
138 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_ietf_encrypt' ) ) { |
|
139 | 139 | /** |
140 | 140 | * @param string $message |
141 | 141 | * @param string $assocData |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | * @param string $key |
144 | 144 | * @return string |
145 | 145 | */ |
146 | - function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
146 | + function sodium_crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ) |
|
147 | 147 | { |
148 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
148 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ); |
|
149 | 149 | } |
150 | 150 | } |
151 | -if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt')) { |
|
151 | +if ( ! is_callable( 'sodium_crypto_aead_xchacha20poly1305_ietf_decrypt' ) ) { |
|
152 | 152 | /** |
153 | 153 | * @param string $message |
154 | 154 | * @param string $assocData |
@@ -156,18 +156,18 @@ discard block |
||
156 | 156 | * @param string $key |
157 | 157 | * @return string |
158 | 158 | */ |
159 | - function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
159 | + function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ) |
|
160 | 160 | { |
161 | 161 | try { |
162 | - return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
163 | - } catch (Error $ex) { |
|
162 | + return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ); |
|
163 | + } catch ( Error $ex ) { |
|
164 | 164 | return false; |
165 | - } catch (Exception $ex) { |
|
165 | + } catch ( Exception $ex ) { |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | } |
170 | -if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')) { |
|
170 | +if ( ! is_callable( 'sodium_crypto_aead_xchacha20poly1305_ietf_encrypt' ) ) { |
|
171 | 171 | /** |
172 | 172 | * @param string $message |
173 | 173 | * @param string $assocData |
@@ -175,47 +175,47 @@ discard block |
||
175 | 175 | * @param string $key |
176 | 176 | * @return string |
177 | 177 | */ |
178 | - function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
178 | + function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ) |
|
179 | 179 | { |
180 | - return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
180 | + return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ); |
|
181 | 181 | } |
182 | 182 | } |
183 | -if (!is_callable('sodium_crypto_auth')) { |
|
183 | +if ( ! is_callable( 'sodium_crypto_auth' ) ) { |
|
184 | 184 | /** |
185 | 185 | * @param string $message |
186 | 186 | * @param string $key |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - function sodium_crypto_auth($message, $key) |
|
189 | + function sodium_crypto_auth( $message, $key ) |
|
190 | 190 | { |
191 | - return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
191 | + return ParagonIE_Sodium_Compat::crypto_auth( $message, $key ); |
|
192 | 192 | } |
193 | 193 | } |
194 | -if (!is_callable('sodium_crypto_auth_verify')) { |
|
194 | +if ( ! is_callable( 'sodium_crypto_auth_verify' ) ) { |
|
195 | 195 | /** |
196 | 196 | * @param string $mac |
197 | 197 | * @param string $message |
198 | 198 | * @param string $key |
199 | 199 | * @return bool |
200 | 200 | */ |
201 | - function sodium_crypto_auth_verify($mac, $message, $key) |
|
201 | + function sodium_crypto_auth_verify( $mac, $message, $key ) |
|
202 | 202 | { |
203 | - return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
203 | + return ParagonIE_Sodium_Compat::crypto_auth_verify( $mac, $message, $key ); |
|
204 | 204 | } |
205 | 205 | } |
206 | -if (!is_callable('sodium_crypto_box')) { |
|
206 | +if ( ! is_callable( 'sodium_crypto_box' ) ) { |
|
207 | 207 | /** |
208 | 208 | * @param string $message |
209 | 209 | * @param string $nonce |
210 | 210 | * @param string $kp |
211 | 211 | * @return string |
212 | 212 | */ |
213 | - function sodium_crypto_box($message, $nonce, $kp) |
|
213 | + function sodium_crypto_box( $message, $nonce, $kp ) |
|
214 | 214 | { |
215 | - return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
215 | + return ParagonIE_Sodium_Compat::crypto_box( $message, $nonce, $kp ); |
|
216 | 216 | } |
217 | 217 | } |
218 | -if (!is_callable('sodium_crypto_box_keypair')) { |
|
218 | +if ( ! is_callable( 'sodium_crypto_box_keypair' ) ) { |
|
219 | 219 | /** |
220 | 220 | * @return string |
221 | 221 | */ |
@@ -224,149 +224,149 @@ discard block |
||
224 | 224 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
225 | 225 | } |
226 | 226 | } |
227 | -if (!is_callable('sodium_crypto_box_keypair_from_secretkey_and_publickey')) { |
|
227 | +if ( ! is_callable( 'sodium_crypto_box_keypair_from_secretkey_and_publickey' ) ) { |
|
228 | 228 | /** |
229 | 229 | * @param string $sk |
230 | 230 | * @param string $pk |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
233 | + function sodium_crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ) |
|
234 | 234 | { |
235 | - return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
235 | + return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ); |
|
236 | 236 | } |
237 | 237 | } |
238 | -if (!is_callable('sodium_crypto_box_open')) { |
|
238 | +if ( ! is_callable( 'sodium_crypto_box_open' ) ) { |
|
239 | 239 | /** |
240 | 240 | * @param string $message |
241 | 241 | * @param string $nonce |
242 | 242 | * @param string $kp |
243 | 243 | * @return string|bool |
244 | 244 | */ |
245 | - function sodium_crypto_box_open($message, $nonce, $kp) |
|
245 | + function sodium_crypto_box_open( $message, $nonce, $kp ) |
|
246 | 246 | { |
247 | 247 | try { |
248 | - return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
249 | - } catch (Error $ex) { |
|
248 | + return ParagonIE_Sodium_Compat::crypto_box_open( $message, $nonce, $kp ); |
|
249 | + } catch ( Error $ex ) { |
|
250 | 250 | return false; |
251 | - } catch (Exception $ex) { |
|
251 | + } catch ( Exception $ex ) { |
|
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | } |
255 | 255 | } |
256 | -if (!is_callable('sodium_crypto_box_publickey')) { |
|
256 | +if ( ! is_callable( 'sodium_crypto_box_publickey' ) ) { |
|
257 | 257 | /** |
258 | 258 | * @param string $keypair |
259 | 259 | * @return string |
260 | 260 | */ |
261 | - function sodium_crypto_box_publickey($keypair) |
|
261 | + function sodium_crypto_box_publickey( $keypair ) |
|
262 | 262 | { |
263 | - return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
263 | + return ParagonIE_Sodium_Compat::crypto_box_publickey( $keypair ); |
|
264 | 264 | } |
265 | 265 | } |
266 | -if (!is_callable('sodium_crypto_box_publickey_from_secretkey')) { |
|
266 | +if ( ! is_callable( 'sodium_crypto_box_publickey_from_secretkey' ) ) { |
|
267 | 267 | /** |
268 | 268 | * @param string $sk |
269 | 269 | * @return string |
270 | 270 | */ |
271 | - function sodium_crypto_box_publickey_from_secretkey($sk) |
|
271 | + function sodium_crypto_box_publickey_from_secretkey( $sk ) |
|
272 | 272 | { |
273 | - return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
273 | + return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey( $sk ); |
|
274 | 274 | } |
275 | 275 | } |
276 | -if (!is_callable('sodium_crypto_box_seal')) { |
|
276 | +if ( ! is_callable( 'sodium_crypto_box_seal' ) ) { |
|
277 | 277 | /** |
278 | 278 | * @param string $message |
279 | 279 | * @param string $publicKey |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - function sodium_crypto_box_seal($message, $publicKey) |
|
282 | + function sodium_crypto_box_seal( $message, $publicKey ) |
|
283 | 283 | { |
284 | - return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
284 | + return ParagonIE_Sodium_Compat::crypto_box_seal( $message, $publicKey ); |
|
285 | 285 | } |
286 | 286 | } |
287 | -if (!is_callable('sodium_crypto_box_seal_open')) { |
|
287 | +if ( ! is_callable( 'sodium_crypto_box_seal_open' ) ) { |
|
288 | 288 | /** |
289 | 289 | * @param string $message |
290 | 290 | * @param string $kp |
291 | 291 | * @return string|bool |
292 | 292 | */ |
293 | - function sodium_crypto_box_seal_open($message, $kp) |
|
293 | + function sodium_crypto_box_seal_open( $message, $kp ) |
|
294 | 294 | { |
295 | 295 | try { |
296 | - return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
297 | - } catch (Error $ex) { |
|
296 | + return ParagonIE_Sodium_Compat::crypto_box_seal_open( $message, $kp ); |
|
297 | + } catch ( Error $ex ) { |
|
298 | 298 | return false; |
299 | - } catch (Exception $ex) { |
|
299 | + } catch ( Exception $ex ) { |
|
300 | 300 | return false; |
301 | 301 | } |
302 | 302 | } |
303 | 303 | } |
304 | -if (!is_callable('sodium_crypto_box_secretkey')) { |
|
304 | +if ( ! is_callable( 'sodium_crypto_box_secretkey' ) ) { |
|
305 | 305 | /** |
306 | 306 | * @param string $keypair |
307 | 307 | * @return string |
308 | 308 | */ |
309 | - function sodium_crypto_box_secretkey($keypair) |
|
309 | + function sodium_crypto_box_secretkey( $keypair ) |
|
310 | 310 | { |
311 | - return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
311 | + return ParagonIE_Sodium_Compat::crypto_box_secretkey( $keypair ); |
|
312 | 312 | } |
313 | 313 | } |
314 | -if (!is_callable('sodium_crypto_box_seed_keypair')) { |
|
314 | +if ( ! is_callable( 'sodium_crypto_box_seed_keypair' ) ) { |
|
315 | 315 | /** |
316 | 316 | * @param string $seed |
317 | 317 | * @return string |
318 | 318 | */ |
319 | - function sodium_crypto_box_seed_keypair($seed) |
|
319 | + function sodium_crypto_box_seed_keypair( $seed ) |
|
320 | 320 | { |
321 | - return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); |
|
321 | + return ParagonIE_Sodium_Compat::crypto_box_seed_keypair( $seed ); |
|
322 | 322 | } |
323 | 323 | } |
324 | -if (!is_callable('sodium_crypto_generichash')) { |
|
324 | +if ( ! is_callable( 'sodium_crypto_generichash' ) ) { |
|
325 | 325 | /** |
326 | 326 | * @param string $message |
327 | 327 | * @param string|null $key |
328 | 328 | * @param int $outLen |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - function sodium_crypto_generichash($message, $key = null, $outLen = 32) |
|
331 | + function sodium_crypto_generichash( $message, $key = null, $outLen = 32 ) |
|
332 | 332 | { |
333 | - return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
333 | + return ParagonIE_Sodium_Compat::crypto_generichash( $message, $key, $outLen ); |
|
334 | 334 | } |
335 | 335 | } |
336 | -if (!is_callable('sodium_crypto_generichash_final')) { |
|
336 | +if ( ! is_callable( 'sodium_crypto_generichash_final' ) ) { |
|
337 | 337 | /** |
338 | 338 | * @param string|null $ctx |
339 | 339 | * @param int $outputLength |
340 | 340 | * @return string |
341 | 341 | */ |
342 | - function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) |
|
342 | + function sodium_crypto_generichash_final( &$ctx, $outputLength = 32 ) |
|
343 | 343 | { |
344 | - return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
344 | + return ParagonIE_Sodium_Compat::crypto_generichash_final( $ctx, $outputLength ); |
|
345 | 345 | } |
346 | 346 | } |
347 | -if (!is_callable('sodium_crypto_generichash_init')) { |
|
347 | +if ( ! is_callable( 'sodium_crypto_generichash_init' ) ) { |
|
348 | 348 | /** |
349 | 349 | * @param string|null $key |
350 | 350 | * @param int $outLen |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - function sodium_crypto_generichash_init($key = null, $outLen = 32) |
|
353 | + function sodium_crypto_generichash_init( $key = null, $outLen = 32 ) |
|
354 | 354 | { |
355 | - return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
355 | + return ParagonIE_Sodium_Compat::crypto_generichash_init( $key, $outLen ); |
|
356 | 356 | } |
357 | 357 | } |
358 | -if (!is_callable('sodium_crypto_generichash_update')) { |
|
358 | +if ( ! is_callable( 'sodium_crypto_generichash_update' ) ) { |
|
359 | 359 | /** |
360 | 360 | * @param string|null $ctx |
361 | 361 | * @param string $message |
362 | 362 | * @return void |
363 | 363 | */ |
364 | - function sodium_crypto_generichash_update(&$ctx, $message = '') |
|
364 | + function sodium_crypto_generichash_update( &$ctx, $message = '' ) |
|
365 | 365 | { |
366 | - ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
366 | + ParagonIE_Sodium_Compat::crypto_generichash_update( $ctx, $message ); |
|
367 | 367 | } |
368 | 368 | } |
369 | -if (!is_callable('sodium_crypto_kx')) { |
|
369 | +if ( ! is_callable( 'sodium_crypto_kx' ) ) { |
|
370 | 370 | /** |
371 | 371 | * @param string $my_secret |
372 | 372 | * @param string $their_public |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @param string $server_public |
375 | 375 | * @return string |
376 | 376 | */ |
377 | - function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
377 | + function sodium_crypto_kx( $my_secret, $their_public, $client_public, $server_public ) |
|
378 | 378 | { |
379 | 379 | return ParagonIE_Sodium_Compat::crypto_kx( |
380 | 380 | $my_secret, |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | ); |
385 | 385 | } |
386 | 386 | } |
387 | -if (!is_callable('sodium_crypto_pwhash')) { |
|
387 | +if ( ! is_callable( 'sodium_crypto_pwhash' ) ) { |
|
388 | 388 | /** |
389 | 389 | * @param int $outlen |
390 | 390 | * @param string $passwd |
@@ -393,35 +393,35 @@ discard block |
||
393 | 393 | * @param int $memlimit |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
396 | + function sodium_crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit ) |
|
397 | 397 | { |
398 | - return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
398 | + return ParagonIE_Sodium_Compat::crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit ); |
|
399 | 399 | } |
400 | 400 | } |
401 | -if (!is_callable('sodium_crypto_pwhash_str')) { |
|
401 | +if ( ! is_callable( 'sodium_crypto_pwhash_str' ) ) { |
|
402 | 402 | /** |
403 | 403 | * @param string $passwd |
404 | 404 | * @param int $opslimit |
405 | 405 | * @param int $memlimit |
406 | 406 | * @return string |
407 | 407 | */ |
408 | - function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
408 | + function sodium_crypto_pwhash_str( $passwd, $opslimit, $memlimit ) |
|
409 | 409 | { |
410 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
410 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str( $passwd, $opslimit, $memlimit ); |
|
411 | 411 | } |
412 | 412 | } |
413 | -if (!is_callable('sodium_crypto_pwhash_str_verify')) { |
|
413 | +if ( ! is_callable( 'sodium_crypto_pwhash_str_verify' ) ) { |
|
414 | 414 | /** |
415 | 415 | * @param string $passwd |
416 | 416 | * @param string $hash |
417 | 417 | * @return bool |
418 | 418 | */ |
419 | - function sodium_crypto_pwhash_str_verify($passwd, $hash) |
|
419 | + function sodium_crypto_pwhash_str_verify( $passwd, $hash ) |
|
420 | 420 | { |
421 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
421 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify( $passwd, $hash ); |
|
422 | 422 | } |
423 | 423 | } |
424 | -if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256')) { |
|
424 | +if ( ! is_callable( 'sodium_crypto_pwhash_scryptsalsa208sha256' ) ) { |
|
425 | 425 | /** |
426 | 426 | * @param int $outlen |
427 | 427 | * @param string $passwd |
@@ -430,119 +430,119 @@ discard block |
||
430 | 430 | * @param int $memlimit |
431 | 431 | * @return string |
432 | 432 | */ |
433 | - function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
433 | + function sodium_crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ) |
|
434 | 434 | { |
435 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
435 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ); |
|
436 | 436 | } |
437 | 437 | } |
438 | -if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str')) { |
|
438 | +if ( ! is_callable( 'sodium_crypto_pwhash_scryptsalsa208sha256_str' ) ) { |
|
439 | 439 | /** |
440 | 440 | * @param string $passwd |
441 | 441 | * @param int $opslimit |
442 | 442 | * @param int $memlimit |
443 | 443 | * @return string |
444 | 444 | */ |
445 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
445 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ) |
|
446 | 446 | { |
447 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
447 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ); |
|
448 | 448 | } |
449 | 449 | } |
450 | -if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str_verify')) { |
|
450 | +if ( ! is_callable( 'sodium_crypto_pwhash_scryptsalsa208sha256_str_verify' ) ) { |
|
451 | 451 | /** |
452 | 452 | * @param string $passwd |
453 | 453 | * @param string $hash |
454 | 454 | * @return bool |
455 | 455 | */ |
456 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
456 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ) |
|
457 | 457 | { |
458 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
458 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ); |
|
459 | 459 | } |
460 | 460 | } |
461 | -if (!is_callable('sodium_crypto_scalarmult')) { |
|
461 | +if ( ! is_callable( 'sodium_crypto_scalarmult' ) ) { |
|
462 | 462 | /** |
463 | 463 | * @param string $n |
464 | 464 | * @param string $p |
465 | 465 | * @return string |
466 | 466 | */ |
467 | - function sodium_crypto_scalarmult($n, $p) |
|
467 | + function sodium_crypto_scalarmult( $n, $p ) |
|
468 | 468 | { |
469 | - return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
469 | + return ParagonIE_Sodium_Compat::crypto_scalarmult( $n, $p ); |
|
470 | 470 | } |
471 | 471 | } |
472 | -if (!is_callable('sodium_crypto_scalarmult_base')) { |
|
472 | +if ( ! is_callable( 'sodium_crypto_scalarmult_base' ) ) { |
|
473 | 473 | /** |
474 | 474 | * @param string $n |
475 | 475 | * @return string |
476 | 476 | */ |
477 | - function sodium_crypto_scalarmult_base($n) |
|
477 | + function sodium_crypto_scalarmult_base( $n ) |
|
478 | 478 | { |
479 | - return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
479 | + return ParagonIE_Sodium_Compat::crypto_scalarmult_base( $n ); |
|
480 | 480 | } |
481 | 481 | } |
482 | -if (!is_callable('sodium_crypto_secretbox')) { |
|
482 | +if ( ! is_callable( 'sodium_crypto_secretbox' ) ) { |
|
483 | 483 | /** |
484 | 484 | * @param string $message |
485 | 485 | * @param string $nonce |
486 | 486 | * @param string $key |
487 | 487 | * @return string |
488 | 488 | */ |
489 | - function sodium_crypto_secretbox($message, $nonce, $key) |
|
489 | + function sodium_crypto_secretbox( $message, $nonce, $key ) |
|
490 | 490 | { |
491 | - return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
491 | + return ParagonIE_Sodium_Compat::crypto_secretbox( $message, $nonce, $key ); |
|
492 | 492 | } |
493 | 493 | } |
494 | -if (!is_callable('sodium_crypto_secretbox_open')) { |
|
494 | +if ( ! is_callable( 'sodium_crypto_secretbox_open' ) ) { |
|
495 | 495 | /** |
496 | 496 | * @param string $message |
497 | 497 | * @param string $nonce |
498 | 498 | * @param string $key |
499 | 499 | * @return string|bool |
500 | 500 | */ |
501 | - function sodium_crypto_secretbox_open($message, $nonce, $key) |
|
501 | + function sodium_crypto_secretbox_open( $message, $nonce, $key ) |
|
502 | 502 | { |
503 | 503 | try { |
504 | - return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
505 | - } catch (Error $ex) { |
|
504 | + return ParagonIE_Sodium_Compat::crypto_secretbox_open( $message, $nonce, $key ); |
|
505 | + } catch ( Error $ex ) { |
|
506 | 506 | return false; |
507 | - } catch (Exception $ex) { |
|
507 | + } catch ( Exception $ex ) { |
|
508 | 508 | return false; |
509 | 509 | } |
510 | 510 | } |
511 | 511 | } |
512 | -if (!is_callable('sodium_crypto_shorthash')) { |
|
512 | +if ( ! is_callable( 'sodium_crypto_shorthash' ) ) { |
|
513 | 513 | /** |
514 | 514 | * @param string $message |
515 | 515 | * @param string $key |
516 | 516 | * @return string |
517 | 517 | */ |
518 | - function sodium_crypto_shorthash($message, $key = '') |
|
518 | + function sodium_crypto_shorthash( $message, $key = '' ) |
|
519 | 519 | { |
520 | - return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
520 | + return ParagonIE_Sodium_Compat::crypto_shorthash( $message, $key ); |
|
521 | 521 | } |
522 | 522 | } |
523 | -if (!is_callable('sodium_crypto_sign')) { |
|
523 | +if ( ! is_callable( 'sodium_crypto_sign' ) ) { |
|
524 | 524 | /** |
525 | 525 | * @param string $message |
526 | 526 | * @param string $sk |
527 | 527 | * @return string |
528 | 528 | */ |
529 | - function sodium_crypto_sign($message, $sk) |
|
529 | + function sodium_crypto_sign( $message, $sk ) |
|
530 | 530 | { |
531 | - return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
531 | + return ParagonIE_Sodium_Compat::crypto_sign( $message, $sk ); |
|
532 | 532 | } |
533 | 533 | } |
534 | -if (!is_callable('sodium_crypto_sign_detached')) { |
|
534 | +if ( ! is_callable( 'sodium_crypto_sign_detached' ) ) { |
|
535 | 535 | /** |
536 | 536 | * @param string $message |
537 | 537 | * @param string $sk |
538 | 538 | * @return string |
539 | 539 | */ |
540 | - function sodium_crypto_sign_detached($message, $sk) |
|
540 | + function sodium_crypto_sign_detached( $message, $sk ) |
|
541 | 541 | { |
542 | - return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
542 | + return ParagonIE_Sodium_Compat::crypto_sign_detached( $message, $sk ); |
|
543 | 543 | } |
544 | 544 | } |
545 | -if (!is_callable('sodium_crypto_sign_keypair')) { |
|
545 | +if ( ! is_callable( 'sodium_crypto_sign_keypair' ) ) { |
|
546 | 546 | /** |
547 | 547 | * @return string |
548 | 548 | */ |
@@ -551,120 +551,120 @@ discard block |
||
551 | 551 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
552 | 552 | } |
553 | 553 | } |
554 | -if (!is_callable('sodium_crypto_sign_open')) { |
|
554 | +if ( ! is_callable( 'sodium_crypto_sign_open' ) ) { |
|
555 | 555 | /** |
556 | 556 | * @param string $signedMessage |
557 | 557 | * @param string $pk |
558 | 558 | * @return string|bool |
559 | 559 | */ |
560 | - function sodium_crypto_sign_open($signedMessage, $pk) |
|
560 | + function sodium_crypto_sign_open( $signedMessage, $pk ) |
|
561 | 561 | { |
562 | 562 | try { |
563 | - return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
564 | - } catch (Error $ex) { |
|
563 | + return ParagonIE_Sodium_Compat::crypto_sign_open( $signedMessage, $pk ); |
|
564 | + } catch ( Error $ex ) { |
|
565 | 565 | return false; |
566 | - } catch (Exception $ex) { |
|
566 | + } catch ( Exception $ex ) { |
|
567 | 567 | return false; |
568 | 568 | } |
569 | 569 | } |
570 | 570 | } |
571 | -if (!is_callable('sodium_crypto_sign_publickey')) { |
|
571 | +if ( ! is_callable( 'sodium_crypto_sign_publickey' ) ) { |
|
572 | 572 | /** |
573 | 573 | * @param string $keypair |
574 | 574 | * @return string |
575 | 575 | */ |
576 | - function sodium_crypto_sign_publickey($keypair) |
|
576 | + function sodium_crypto_sign_publickey( $keypair ) |
|
577 | 577 | { |
578 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
578 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey( $keypair ); |
|
579 | 579 | } |
580 | 580 | } |
581 | -if (!is_callable('sodium_crypto_sign_publickey_from_secretkey')) { |
|
581 | +if ( ! is_callable( 'sodium_crypto_sign_publickey_from_secretkey' ) ) { |
|
582 | 582 | /** |
583 | 583 | * @param string $sk |
584 | 584 | * @return string |
585 | 585 | */ |
586 | - function sodium_crypto_sign_publickey_from_secretkey($sk) |
|
586 | + function sodium_crypto_sign_publickey_from_secretkey( $sk ) |
|
587 | 587 | { |
588 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
588 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey( $sk ); |
|
589 | 589 | } |
590 | 590 | } |
591 | -if (!is_callable('sodium_crypto_sign_secretkey')) { |
|
591 | +if ( ! is_callable( 'sodium_crypto_sign_secretkey' ) ) { |
|
592 | 592 | /** |
593 | 593 | * @param string $keypair |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - function sodium_crypto_sign_secretkey($keypair) |
|
596 | + function sodium_crypto_sign_secretkey( $keypair ) |
|
597 | 597 | { |
598 | - return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
598 | + return ParagonIE_Sodium_Compat::crypto_sign_secretkey( $keypair ); |
|
599 | 599 | } |
600 | 600 | } |
601 | -if (!is_callable('sodium_crypto_sign_seed_keypair')) { |
|
601 | +if ( ! is_callable( 'sodium_crypto_sign_seed_keypair' ) ) { |
|
602 | 602 | /** |
603 | 603 | * @param string $seed |
604 | 604 | * @return string |
605 | 605 | */ |
606 | - function sodium_crypto_sign_seed_keypair($seed) |
|
606 | + function sodium_crypto_sign_seed_keypair( $seed ) |
|
607 | 607 | { |
608 | - return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
608 | + return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair( $seed ); |
|
609 | 609 | } |
610 | 610 | } |
611 | -if (!is_callable('sodium_crypto_sign_verify_detached')) { |
|
611 | +if ( ! is_callable( 'sodium_crypto_sign_verify_detached' ) ) { |
|
612 | 612 | /** |
613 | 613 | * @param string $signature |
614 | 614 | * @param string $message |
615 | 615 | * @param string $pk |
616 | 616 | * @return bool |
617 | 617 | */ |
618 | - function sodium_crypto_sign_verify_detached($signature, $message, $pk) |
|
618 | + function sodium_crypto_sign_verify_detached( $signature, $message, $pk ) |
|
619 | 619 | { |
620 | - return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
620 | + return ParagonIE_Sodium_Compat::crypto_sign_verify_detached( $signature, $message, $pk ); |
|
621 | 621 | } |
622 | 622 | } |
623 | -if (!is_callable('sodium_crypto_stream')) { |
|
623 | +if ( ! is_callable( 'sodium_crypto_stream' ) ) { |
|
624 | 624 | /** |
625 | 625 | * @param int $len |
626 | 626 | * @param string $nonce |
627 | 627 | * @param string $key |
628 | 628 | * @return string |
629 | 629 | */ |
630 | - function sodium_crypto_stream($len, $nonce, $key) |
|
630 | + function sodium_crypto_stream( $len, $nonce, $key ) |
|
631 | 631 | { |
632 | - return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
632 | + return ParagonIE_Sodium_Compat::crypto_stream( $len, $nonce, $key ); |
|
633 | 633 | } |
634 | 634 | } |
635 | -if (!is_callable('sodium_crypto_stream_xor')) { |
|
635 | +if ( ! is_callable( 'sodium_crypto_stream_xor' ) ) { |
|
636 | 636 | /** |
637 | 637 | * @param string $message |
638 | 638 | * @param string $nonce |
639 | 639 | * @param string $key |
640 | 640 | * @return string |
641 | 641 | */ |
642 | - function sodium_crypto_stream_xor($message, $nonce, $key) |
|
642 | + function sodium_crypto_stream_xor( $message, $nonce, $key ) |
|
643 | 643 | { |
644 | - return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
644 | + return ParagonIE_Sodium_Compat::crypto_stream_xor( $message, $nonce, $key ); |
|
645 | 645 | } |
646 | 646 | } |
647 | -if (!is_callable('sodium_hex2bin')) { |
|
647 | +if ( ! is_callable( 'sodium_hex2bin' ) ) { |
|
648 | 648 | /** |
649 | 649 | * @param string $string |
650 | 650 | * @return string |
651 | 651 | */ |
652 | - function sodium_hex2bin($string) |
|
652 | + function sodium_hex2bin( $string ) |
|
653 | 653 | { |
654 | - return ParagonIE_Sodium_Compat::hex2bin($string); |
|
654 | + return ParagonIE_Sodium_Compat::hex2bin( $string ); |
|
655 | 655 | } |
656 | 656 | } |
657 | -if (!is_callable('sodium_increment')) { |
|
657 | +if ( ! is_callable( 'sodium_increment' ) ) { |
|
658 | 658 | /** |
659 | 659 | * @param &string $string |
660 | 660 | * @return void |
661 | 661 | */ |
662 | - function sodium_increment(&$string) |
|
662 | + function sodium_increment( &$string ) |
|
663 | 663 | { |
664 | - ParagonIE_Sodium_Compat::increment($string); |
|
664 | + ParagonIE_Sodium_Compat::increment( $string ); |
|
665 | 665 | } |
666 | 666 | } |
667 | -if (!is_callable('sodium_library_version_major')) { |
|
667 | +if ( ! is_callable( 'sodium_library_version_major' ) ) { |
|
668 | 668 | /** |
669 | 669 | * @return int |
670 | 670 | */ |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | return ParagonIE_Sodium_Compat::library_version_major(); |
674 | 674 | } |
675 | 675 | } |
676 | -if (!is_callable('sodium_library_version_minor')) { |
|
676 | +if ( ! is_callable( 'sodium_library_version_minor' ) ) { |
|
677 | 677 | /** |
678 | 678 | * @return int |
679 | 679 | */ |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | return ParagonIE_Sodium_Compat::library_version_minor(); |
683 | 683 | } |
684 | 684 | } |
685 | -if (!is_callable('sodium_version_string')) { |
|
685 | +if ( ! is_callable( 'sodium_version_string' ) ) { |
|
686 | 686 | /** |
687 | 687 | * @return string |
688 | 688 | */ |
@@ -691,50 +691,50 @@ discard block |
||
691 | 691 | return ParagonIE_Sodium_Compat::version_string(); |
692 | 692 | } |
693 | 693 | } |
694 | -if (!is_callable('sodium_memcmp')) { |
|
694 | +if ( ! is_callable( 'sodium_memcmp' ) ) { |
|
695 | 695 | /** |
696 | 696 | * @param string $a |
697 | 697 | * @param string $b |
698 | 698 | * @return int |
699 | 699 | */ |
700 | - function sodium_memcmp($a, $b) |
|
700 | + function sodium_memcmp( $a, $b ) |
|
701 | 701 | { |
702 | - return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
702 | + return ParagonIE_Sodium_Compat::memcmp( $a, $b ); |
|
703 | 703 | } |
704 | 704 | } |
705 | -if (!is_callable('sodium_memzero')) { |
|
705 | +if ( ! is_callable( 'sodium_memzero' ) ) { |
|
706 | 706 | /** |
707 | 707 | * @param string &$str |
708 | 708 | * @return void |
709 | 709 | */ |
710 | - function sodium_memzero(&$str) |
|
710 | + function sodium_memzero( &$str ) |
|
711 | 711 | { |
712 | - ParagonIE_Sodium_Compat::memzero($str); |
|
712 | + ParagonIE_Sodium_Compat::memzero( $str ); |
|
713 | 713 | } |
714 | 714 | } |
715 | -if (!is_callable('sodium_randombytes_buf')) { |
|
715 | +if ( ! is_callable( 'sodium_randombytes_buf' ) ) { |
|
716 | 716 | /** |
717 | 717 | * @param int $amount |
718 | 718 | * @return string |
719 | 719 | */ |
720 | - function sodium_randombytes_buf($amount) |
|
720 | + function sodium_randombytes_buf( $amount ) |
|
721 | 721 | { |
722 | - return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
722 | + return ParagonIE_Sodium_Compat::randombytes_buf( $amount ); |
|
723 | 723 | } |
724 | 724 | } |
725 | 725 | |
726 | -if (!is_callable('sodium_randombytes_uniform')) { |
|
726 | +if ( ! is_callable( 'sodium_randombytes_uniform' ) ) { |
|
727 | 727 | /** |
728 | 728 | * @param int $upperLimit |
729 | 729 | * @return int |
730 | 730 | */ |
731 | - function sodium_randombytes_uniform($upperLimit) |
|
731 | + function sodium_randombytes_uniform( $upperLimit ) |
|
732 | 732 | { |
733 | - return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
733 | + return ParagonIE_Sodium_Compat::randombytes_uniform( $upperLimit ); |
|
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | -if (!is_callable('sodium_randombytes_random16')) { |
|
737 | +if ( ! is_callable( 'sodium_randombytes_random16' ) ) { |
|
738 | 738 | /** |
739 | 739 | * @return int |
740 | 740 | */ |
@@ -68,8 +68,7 @@ discard block |
||
68 | 68 | * @param string $string |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - function sodium_bin2hex($string) |
|
72 | - { |
|
71 | + function sodium_bin2hex($string) { |
|
73 | 72 | return ParagonIE_Sodium_Compat::bin2hex($string); |
74 | 73 | } |
75 | 74 | } |
@@ -79,8 +78,7 @@ discard block |
||
79 | 78 | * @param string $b |
80 | 79 | * @return int |
81 | 80 | */ |
82 | - function sodium_compare($a, $b) |
|
83 | - { |
|
81 | + function sodium_compare($a, $b) { |
|
84 | 82 | return ParagonIE_Sodium_Compat::compare($a, $b); |
85 | 83 | } |
86 | 84 | } |
@@ -92,8 +90,7 @@ discard block |
||
92 | 90 | * @param string $key |
93 | 91 | * @return string |
94 | 92 | */ |
95 | - function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
96 | - { |
|
93 | + function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) { |
|
97 | 94 | try { |
98 | 95 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
99 | 96 | } catch (Error $ex) { |
@@ -111,8 +108,7 @@ discard block |
||
111 | 108 | * @param string $key |
112 | 109 | * @return string |
113 | 110 | */ |
114 | - function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
115 | - { |
|
111 | + function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) { |
|
116 | 112 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
117 | 113 | } |
118 | 114 | } |
@@ -124,8 +120,7 @@ discard block |
||
124 | 120 | * @param string $key |
125 | 121 | * @return string |
126 | 122 | */ |
127 | - function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
128 | - { |
|
123 | + function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) { |
|
129 | 124 | try { |
130 | 125 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
131 | 126 | } catch (Error $ex) { |
@@ -143,8 +138,7 @@ discard block |
||
143 | 138 | * @param string $key |
144 | 139 | * @return string |
145 | 140 | */ |
146 | - function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
147 | - { |
|
141 | + function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) { |
|
148 | 142 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
149 | 143 | } |
150 | 144 | } |
@@ -156,8 +150,7 @@ discard block |
||
156 | 150 | * @param string $key |
157 | 151 | * @return string |
158 | 152 | */ |
159 | - function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
160 | - { |
|
153 | + function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) { |
|
161 | 154 | try { |
162 | 155 | return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
163 | 156 | } catch (Error $ex) { |
@@ -175,8 +168,7 @@ discard block |
||
175 | 168 | * @param string $key |
176 | 169 | * @return string |
177 | 170 | */ |
178 | - function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
179 | - { |
|
171 | + function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) { |
|
180 | 172 | return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
181 | 173 | } |
182 | 174 | } |
@@ -186,8 +178,7 @@ discard block |
||
186 | 178 | * @param string $key |
187 | 179 | * @return string |
188 | 180 | */ |
189 | - function sodium_crypto_auth($message, $key) |
|
190 | - { |
|
181 | + function sodium_crypto_auth($message, $key) { |
|
191 | 182 | return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
192 | 183 | } |
193 | 184 | } |
@@ -198,8 +189,7 @@ discard block |
||
198 | 189 | * @param string $key |
199 | 190 | * @return bool |
200 | 191 | */ |
201 | - function sodium_crypto_auth_verify($mac, $message, $key) |
|
202 | - { |
|
192 | + function sodium_crypto_auth_verify($mac, $message, $key) { |
|
203 | 193 | return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
204 | 194 | } |
205 | 195 | } |
@@ -210,8 +200,7 @@ discard block |
||
210 | 200 | * @param string $kp |
211 | 201 | * @return string |
212 | 202 | */ |
213 | - function sodium_crypto_box($message, $nonce, $kp) |
|
214 | - { |
|
203 | + function sodium_crypto_box($message, $nonce, $kp) { |
|
215 | 204 | return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
216 | 205 | } |
217 | 206 | } |
@@ -219,8 +208,7 @@ discard block |
||
219 | 208 | /** |
220 | 209 | * @return string |
221 | 210 | */ |
222 | - function sodium_crypto_box_keypair() |
|
223 | - { |
|
211 | + function sodium_crypto_box_keypair() { |
|
224 | 212 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
225 | 213 | } |
226 | 214 | } |
@@ -230,8 +218,7 @@ discard block |
||
230 | 218 | * @param string $pk |
231 | 219 | * @return string |
232 | 220 | */ |
233 | - function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
234 | - { |
|
221 | + function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) { |
|
235 | 222 | return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
236 | 223 | } |
237 | 224 | } |
@@ -242,8 +229,7 @@ discard block |
||
242 | 229 | * @param string $kp |
243 | 230 | * @return string|bool |
244 | 231 | */ |
245 | - function sodium_crypto_box_open($message, $nonce, $kp) |
|
246 | - { |
|
232 | + function sodium_crypto_box_open($message, $nonce, $kp) { |
|
247 | 233 | try { |
248 | 234 | return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
249 | 235 | } catch (Error $ex) { |
@@ -258,8 +244,7 @@ discard block |
||
258 | 244 | * @param string $keypair |
259 | 245 | * @return string |
260 | 246 | */ |
261 | - function sodium_crypto_box_publickey($keypair) |
|
262 | - { |
|
247 | + function sodium_crypto_box_publickey($keypair) { |
|
263 | 248 | return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
264 | 249 | } |
265 | 250 | } |
@@ -268,8 +253,7 @@ discard block |
||
268 | 253 | * @param string $sk |
269 | 254 | * @return string |
270 | 255 | */ |
271 | - function sodium_crypto_box_publickey_from_secretkey($sk) |
|
272 | - { |
|
256 | + function sodium_crypto_box_publickey_from_secretkey($sk) { |
|
273 | 257 | return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
274 | 258 | } |
275 | 259 | } |
@@ -279,8 +263,7 @@ discard block |
||
279 | 263 | * @param string $publicKey |
280 | 264 | * @return string |
281 | 265 | */ |
282 | - function sodium_crypto_box_seal($message, $publicKey) |
|
283 | - { |
|
266 | + function sodium_crypto_box_seal($message, $publicKey) { |
|
284 | 267 | return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
285 | 268 | } |
286 | 269 | } |
@@ -290,8 +273,7 @@ discard block |
||
290 | 273 | * @param string $kp |
291 | 274 | * @return string|bool |
292 | 275 | */ |
293 | - function sodium_crypto_box_seal_open($message, $kp) |
|
294 | - { |
|
276 | + function sodium_crypto_box_seal_open($message, $kp) { |
|
295 | 277 | try { |
296 | 278 | return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
297 | 279 | } catch (Error $ex) { |
@@ -306,8 +288,7 @@ discard block |
||
306 | 288 | * @param string $keypair |
307 | 289 | * @return string |
308 | 290 | */ |
309 | - function sodium_crypto_box_secretkey($keypair) |
|
310 | - { |
|
291 | + function sodium_crypto_box_secretkey($keypair) { |
|
311 | 292 | return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
312 | 293 | } |
313 | 294 | } |
@@ -316,8 +297,7 @@ discard block |
||
316 | 297 | * @param string $seed |
317 | 298 | * @return string |
318 | 299 | */ |
319 | - function sodium_crypto_box_seed_keypair($seed) |
|
320 | - { |
|
300 | + function sodium_crypto_box_seed_keypair($seed) { |
|
321 | 301 | return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); |
322 | 302 | } |
323 | 303 | } |
@@ -328,8 +308,7 @@ discard block |
||
328 | 308 | * @param int $outLen |
329 | 309 | * @return string |
330 | 310 | */ |
331 | - function sodium_crypto_generichash($message, $key = null, $outLen = 32) |
|
332 | - { |
|
311 | + function sodium_crypto_generichash($message, $key = null, $outLen = 32) { |
|
333 | 312 | return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
334 | 313 | } |
335 | 314 | } |
@@ -339,8 +318,7 @@ discard block |
||
339 | 318 | * @param int $outputLength |
340 | 319 | * @return string |
341 | 320 | */ |
342 | - function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) |
|
343 | - { |
|
321 | + function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) { |
|
344 | 322 | return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
345 | 323 | } |
346 | 324 | } |
@@ -350,8 +328,7 @@ discard block |
||
350 | 328 | * @param int $outLen |
351 | 329 | * @return string |
352 | 330 | */ |
353 | - function sodium_crypto_generichash_init($key = null, $outLen = 32) |
|
354 | - { |
|
331 | + function sodium_crypto_generichash_init($key = null, $outLen = 32) { |
|
355 | 332 | return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
356 | 333 | } |
357 | 334 | } |
@@ -361,8 +338,7 @@ discard block |
||
361 | 338 | * @param string $message |
362 | 339 | * @return void |
363 | 340 | */ |
364 | - function sodium_crypto_generichash_update(&$ctx, $message = '') |
|
365 | - { |
|
341 | + function sodium_crypto_generichash_update(&$ctx, $message = '') { |
|
366 | 342 | ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
367 | 343 | } |
368 | 344 | } |
@@ -374,8 +350,7 @@ discard block |
||
374 | 350 | * @param string $server_public |
375 | 351 | * @return string |
376 | 352 | */ |
377 | - function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
378 | - { |
|
353 | + function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) { |
|
379 | 354 | return ParagonIE_Sodium_Compat::crypto_kx( |
380 | 355 | $my_secret, |
381 | 356 | $their_public, |
@@ -393,8 +368,7 @@ discard block |
||
393 | 368 | * @param int $memlimit |
394 | 369 | * @return string |
395 | 370 | */ |
396 | - function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
397 | - { |
|
371 | + function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
398 | 372 | return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
399 | 373 | } |
400 | 374 | } |
@@ -405,8 +379,7 @@ discard block |
||
405 | 379 | * @param int $memlimit |
406 | 380 | * @return string |
407 | 381 | */ |
408 | - function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
409 | - { |
|
382 | + function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) { |
|
410 | 383 | return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
411 | 384 | } |
412 | 385 | } |
@@ -416,8 +389,7 @@ discard block |
||
416 | 389 | * @param string $hash |
417 | 390 | * @return bool |
418 | 391 | */ |
419 | - function sodium_crypto_pwhash_str_verify($passwd, $hash) |
|
420 | - { |
|
392 | + function sodium_crypto_pwhash_str_verify($passwd, $hash) { |
|
421 | 393 | return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
422 | 394 | } |
423 | 395 | } |
@@ -430,8 +402,7 @@ discard block |
||
430 | 402 | * @param int $memlimit |
431 | 403 | * @return string |
432 | 404 | */ |
433 | - function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
434 | - { |
|
405 | + function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
435 | 406 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
436 | 407 | } |
437 | 408 | } |
@@ -442,8 +413,7 @@ discard block |
||
442 | 413 | * @param int $memlimit |
443 | 414 | * @return string |
444 | 415 | */ |
445 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
446 | - { |
|
416 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) { |
|
447 | 417 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
448 | 418 | } |
449 | 419 | } |
@@ -453,8 +423,7 @@ discard block |
||
453 | 423 | * @param string $hash |
454 | 424 | * @return bool |
455 | 425 | */ |
456 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
457 | - { |
|
426 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) { |
|
458 | 427 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
459 | 428 | } |
460 | 429 | } |
@@ -464,8 +433,7 @@ discard block |
||
464 | 433 | * @param string $p |
465 | 434 | * @return string |
466 | 435 | */ |
467 | - function sodium_crypto_scalarmult($n, $p) |
|
468 | - { |
|
436 | + function sodium_crypto_scalarmult($n, $p) { |
|
469 | 437 | return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
470 | 438 | } |
471 | 439 | } |
@@ -474,8 +442,7 @@ discard block |
||
474 | 442 | * @param string $n |
475 | 443 | * @return string |
476 | 444 | */ |
477 | - function sodium_crypto_scalarmult_base($n) |
|
478 | - { |
|
445 | + function sodium_crypto_scalarmult_base($n) { |
|
479 | 446 | return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
480 | 447 | } |
481 | 448 | } |
@@ -486,8 +453,7 @@ discard block |
||
486 | 453 | * @param string $key |
487 | 454 | * @return string |
488 | 455 | */ |
489 | - function sodium_crypto_secretbox($message, $nonce, $key) |
|
490 | - { |
|
456 | + function sodium_crypto_secretbox($message, $nonce, $key) { |
|
491 | 457 | return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
492 | 458 | } |
493 | 459 | } |
@@ -498,8 +464,7 @@ discard block |
||
498 | 464 | * @param string $key |
499 | 465 | * @return string|bool |
500 | 466 | */ |
501 | - function sodium_crypto_secretbox_open($message, $nonce, $key) |
|
502 | - { |
|
467 | + function sodium_crypto_secretbox_open($message, $nonce, $key) { |
|
503 | 468 | try { |
504 | 469 | return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
505 | 470 | } catch (Error $ex) { |
@@ -515,8 +480,7 @@ discard block |
||
515 | 480 | * @param string $key |
516 | 481 | * @return string |
517 | 482 | */ |
518 | - function sodium_crypto_shorthash($message, $key = '') |
|
519 | - { |
|
483 | + function sodium_crypto_shorthash($message, $key = '') { |
|
520 | 484 | return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
521 | 485 | } |
522 | 486 | } |
@@ -526,8 +490,7 @@ discard block |
||
526 | 490 | * @param string $sk |
527 | 491 | * @return string |
528 | 492 | */ |
529 | - function sodium_crypto_sign($message, $sk) |
|
530 | - { |
|
493 | + function sodium_crypto_sign($message, $sk) { |
|
531 | 494 | return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
532 | 495 | } |
533 | 496 | } |
@@ -537,8 +500,7 @@ discard block |
||
537 | 500 | * @param string $sk |
538 | 501 | * @return string |
539 | 502 | */ |
540 | - function sodium_crypto_sign_detached($message, $sk) |
|
541 | - { |
|
503 | + function sodium_crypto_sign_detached($message, $sk) { |
|
542 | 504 | return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
543 | 505 | } |
544 | 506 | } |
@@ -546,8 +508,7 @@ discard block |
||
546 | 508 | /** |
547 | 509 | * @return string |
548 | 510 | */ |
549 | - function sodium_crypto_sign_keypair() |
|
550 | - { |
|
511 | + function sodium_crypto_sign_keypair() { |
|
551 | 512 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
552 | 513 | } |
553 | 514 | } |
@@ -557,8 +518,7 @@ discard block |
||
557 | 518 | * @param string $pk |
558 | 519 | * @return string|bool |
559 | 520 | */ |
560 | - function sodium_crypto_sign_open($signedMessage, $pk) |
|
561 | - { |
|
521 | + function sodium_crypto_sign_open($signedMessage, $pk) { |
|
562 | 522 | try { |
563 | 523 | return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
564 | 524 | } catch (Error $ex) { |
@@ -573,8 +533,7 @@ discard block |
||
573 | 533 | * @param string $keypair |
574 | 534 | * @return string |
575 | 535 | */ |
576 | - function sodium_crypto_sign_publickey($keypair) |
|
577 | - { |
|
536 | + function sodium_crypto_sign_publickey($keypair) { |
|
578 | 537 | return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
579 | 538 | } |
580 | 539 | } |
@@ -583,8 +542,7 @@ discard block |
||
583 | 542 | * @param string $sk |
584 | 543 | * @return string |
585 | 544 | */ |
586 | - function sodium_crypto_sign_publickey_from_secretkey($sk) |
|
587 | - { |
|
545 | + function sodium_crypto_sign_publickey_from_secretkey($sk) { |
|
588 | 546 | return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
589 | 547 | } |
590 | 548 | } |
@@ -593,8 +551,7 @@ discard block |
||
593 | 551 | * @param string $keypair |
594 | 552 | * @return string |
595 | 553 | */ |
596 | - function sodium_crypto_sign_secretkey($keypair) |
|
597 | - { |
|
554 | + function sodium_crypto_sign_secretkey($keypair) { |
|
598 | 555 | return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
599 | 556 | } |
600 | 557 | } |
@@ -603,8 +560,7 @@ discard block |
||
603 | 560 | * @param string $seed |
604 | 561 | * @return string |
605 | 562 | */ |
606 | - function sodium_crypto_sign_seed_keypair($seed) |
|
607 | - { |
|
563 | + function sodium_crypto_sign_seed_keypair($seed) { |
|
608 | 564 | return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
609 | 565 | } |
610 | 566 | } |
@@ -615,8 +571,7 @@ discard block |
||
615 | 571 | * @param string $pk |
616 | 572 | * @return bool |
617 | 573 | */ |
618 | - function sodium_crypto_sign_verify_detached($signature, $message, $pk) |
|
619 | - { |
|
574 | + function sodium_crypto_sign_verify_detached($signature, $message, $pk) { |
|
620 | 575 | return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
621 | 576 | } |
622 | 577 | } |
@@ -627,8 +582,7 @@ discard block |
||
627 | 582 | * @param string $key |
628 | 583 | * @return string |
629 | 584 | */ |
630 | - function sodium_crypto_stream($len, $nonce, $key) |
|
631 | - { |
|
585 | + function sodium_crypto_stream($len, $nonce, $key) { |
|
632 | 586 | return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
633 | 587 | } |
634 | 588 | } |
@@ -639,8 +593,7 @@ discard block |
||
639 | 593 | * @param string $key |
640 | 594 | * @return string |
641 | 595 | */ |
642 | - function sodium_crypto_stream_xor($message, $nonce, $key) |
|
643 | - { |
|
596 | + function sodium_crypto_stream_xor($message, $nonce, $key) { |
|
644 | 597 | return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
645 | 598 | } |
646 | 599 | } |
@@ -649,8 +602,7 @@ discard block |
||
649 | 602 | * @param string $string |
650 | 603 | * @return string |
651 | 604 | */ |
652 | - function sodium_hex2bin($string) |
|
653 | - { |
|
605 | + function sodium_hex2bin($string) { |
|
654 | 606 | return ParagonIE_Sodium_Compat::hex2bin($string); |
655 | 607 | } |
656 | 608 | } |
@@ -659,8 +611,7 @@ discard block |
||
659 | 611 | * @param &string $string |
660 | 612 | * @return void |
661 | 613 | */ |
662 | - function sodium_increment(&$string) |
|
663 | - { |
|
614 | + function sodium_increment(&$string) { |
|
664 | 615 | ParagonIE_Sodium_Compat::increment($string); |
665 | 616 | } |
666 | 617 | } |
@@ -668,8 +619,7 @@ discard block |
||
668 | 619 | /** |
669 | 620 | * @return int |
670 | 621 | */ |
671 | - function sodium_library_version_major() |
|
672 | - { |
|
622 | + function sodium_library_version_major() { |
|
673 | 623 | return ParagonIE_Sodium_Compat::library_version_major(); |
674 | 624 | } |
675 | 625 | } |
@@ -677,8 +627,7 @@ discard block |
||
677 | 627 | /** |
678 | 628 | * @return int |
679 | 629 | */ |
680 | - function sodium_library_version_minor() |
|
681 | - { |
|
630 | + function sodium_library_version_minor() { |
|
682 | 631 | return ParagonIE_Sodium_Compat::library_version_minor(); |
683 | 632 | } |
684 | 633 | } |
@@ -686,8 +635,7 @@ discard block |
||
686 | 635 | /** |
687 | 636 | * @return string |
688 | 637 | */ |
689 | - function sodium_version_string() |
|
690 | - { |
|
638 | + function sodium_version_string() { |
|
691 | 639 | return ParagonIE_Sodium_Compat::version_string(); |
692 | 640 | } |
693 | 641 | } |
@@ -697,8 +645,7 @@ discard block |
||
697 | 645 | * @param string $b |
698 | 646 | * @return int |
699 | 647 | */ |
700 | - function sodium_memcmp($a, $b) |
|
701 | - { |
|
648 | + function sodium_memcmp($a, $b) { |
|
702 | 649 | return ParagonIE_Sodium_Compat::memcmp($a, $b); |
703 | 650 | } |
704 | 651 | } |
@@ -707,8 +654,7 @@ discard block |
||
707 | 654 | * @param string &$str |
708 | 655 | * @return void |
709 | 656 | */ |
710 | - function sodium_memzero(&$str) |
|
711 | - { |
|
657 | + function sodium_memzero(&$str) { |
|
712 | 658 | ParagonIE_Sodium_Compat::memzero($str); |
713 | 659 | } |
714 | 660 | } |
@@ -717,8 +663,7 @@ discard block |
||
717 | 663 | * @param int $amount |
718 | 664 | * @return string |
719 | 665 | */ |
720 | - function sodium_randombytes_buf($amount) |
|
721 | - { |
|
666 | + function sodium_randombytes_buf($amount) { |
|
722 | 667 | return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
723 | 668 | } |
724 | 669 | } |
@@ -728,8 +673,7 @@ discard block |
||
728 | 673 | * @param int $upperLimit |
729 | 674 | * @return int |
730 | 675 | */ |
731 | - function sodium_randombytes_uniform($upperLimit) |
|
732 | - { |
|
676 | + function sodium_randombytes_uniform($upperLimit) { |
|
733 | 677 | return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
734 | 678 | } |
735 | 679 | } |
@@ -738,8 +682,7 @@ discard block |
||
738 | 682 | /** |
739 | 683 | * @return int |
740 | 684 | */ |
741 | - function sodium_randombytes_random16() |
|
742 | - { |
|
685 | + function sodium_randombytes_random16() { |
|
743 | 686 | return ParagonIE_Sodium_Compat::randombytes_random16(); |
744 | 687 | } |
745 | 688 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param string $assocData |
38 | 38 | * @param string $nonce |
39 | 39 | * @param string $key |
40 | - * @return string|bool |
|
40 | + * @return string|false |
|
41 | 41 | */ |
42 | 42 | function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
43 | 43 | { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param string $assocData |
70 | 70 | * @param string $nonce |
71 | 71 | * @param string $key |
72 | - * @return string|bool |
|
72 | + * @return string|false |
|
73 | 73 | */ |
74 | 74 | function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
75 | 75 | { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param string $message |
156 | 156 | * @param string $nonce |
157 | 157 | * @param string $kp |
158 | - * @return string|bool |
|
158 | + * @return string|false |
|
159 | 159 | */ |
160 | 160 | function crypto_box_open($message, $nonce, $kp) |
161 | 161 | { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | /** |
204 | 204 | * @param string $message |
205 | 205 | * @param string $kp |
206 | - * @return string|bool |
|
206 | + * @return string|false |
|
207 | 207 | */ |
208 | 208 | function crypto_box_seal_open($message, $kp) |
209 | 209 | { |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @param string $message |
402 | 402 | * @param string $nonce |
403 | 403 | * @param string $key |
404 | - * @return string|bool |
|
404 | + * @return string|false |
|
405 | 405 | */ |
406 | 406 | function crypto_secretbox_open($message, $nonce, $key) |
407 | 407 | { |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | /** |
461 | 461 | * @param string $signedMessage |
462 | 462 | * @param string $pk |
463 | - * @return string|bool |
|
463 | + * @return string|false |
|
464 | 464 | */ |
465 | 465 | function crypto_sign_open($signedMessage, $pk) |
466 | 466 | { |
@@ -11,617 +11,617 @@ |
||
11 | 11 | * method. |
12 | 12 | */ |
13 | 13 | if (!is_callable('\\Sodium\\bin2hex')) { |
14 | - /** |
|
15 | - * @param string $string |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - function bin2hex($string) |
|
19 | - { |
|
20 | - return ParagonIE_Sodium_Compat::bin2hex($string); |
|
21 | - } |
|
14 | + /** |
|
15 | + * @param string $string |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + function bin2hex($string) |
|
19 | + { |
|
20 | + return ParagonIE_Sodium_Compat::bin2hex($string); |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | if (!is_callable('\\Sodium\\compare')) { |
24 | - /** |
|
25 | - * @param string $a |
|
26 | - * @param string $b |
|
27 | - * @return int |
|
28 | - */ |
|
29 | - function compare($a, $b) |
|
30 | - { |
|
31 | - return ParagonIE_Sodium_Compat::compare($a, $b); |
|
32 | - } |
|
24 | + /** |
|
25 | + * @param string $a |
|
26 | + * @param string $b |
|
27 | + * @return int |
|
28 | + */ |
|
29 | + function compare($a, $b) |
|
30 | + { |
|
31 | + return ParagonIE_Sodium_Compat::compare($a, $b); |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_decrypt')) { |
35 | - /** |
|
36 | - * @param string $message |
|
37 | - * @param string $assocData |
|
38 | - * @param string $nonce |
|
39 | - * @param string $key |
|
40 | - * @return string|bool |
|
41 | - */ |
|
42 | - function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
43 | - { |
|
44 | - try { |
|
45 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
46 | - } catch (Error $ex) { |
|
47 | - return false; |
|
48 | - } catch (Exception $ex) { |
|
49 | - return false; |
|
50 | - } |
|
51 | - } |
|
35 | + /** |
|
36 | + * @param string $message |
|
37 | + * @param string $assocData |
|
38 | + * @param string $nonce |
|
39 | + * @param string $key |
|
40 | + * @return string|bool |
|
41 | + */ |
|
42 | + function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
43 | + { |
|
44 | + try { |
|
45 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
46 | + } catch (Error $ex) { |
|
47 | + return false; |
|
48 | + } catch (Exception $ex) { |
|
49 | + return false; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_encrypt')) { |
54 | - /** |
|
55 | - * @param string $message |
|
56 | - * @param string $assocData |
|
57 | - * @param string $nonce |
|
58 | - * @param string $key |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
62 | - { |
|
63 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
64 | - } |
|
54 | + /** |
|
55 | + * @param string $message |
|
56 | + * @param string $assocData |
|
57 | + * @param string $nonce |
|
58 | + * @param string $key |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
62 | + { |
|
63 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_decrypt')) { |
67 | - /** |
|
68 | - * @param string $message |
|
69 | - * @param string $assocData |
|
70 | - * @param string $nonce |
|
71 | - * @param string $key |
|
72 | - * @return string|bool |
|
73 | - */ |
|
74 | - function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
75 | - { |
|
76 | - try { |
|
77 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
78 | - } catch (Error $ex) { |
|
79 | - return false; |
|
80 | - } catch (Exception $ex) { |
|
81 | - return false; |
|
82 | - } |
|
83 | - } |
|
67 | + /** |
|
68 | + * @param string $message |
|
69 | + * @param string $assocData |
|
70 | + * @param string $nonce |
|
71 | + * @param string $key |
|
72 | + * @return string|bool |
|
73 | + */ |
|
74 | + function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
75 | + { |
|
76 | + try { |
|
77 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
78 | + } catch (Error $ex) { |
|
79 | + return false; |
|
80 | + } catch (Exception $ex) { |
|
81 | + return false; |
|
82 | + } |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_encrypt')) { |
86 | - /** |
|
87 | - * @param string $message |
|
88 | - * @param string $assocData |
|
89 | - * @param string $nonce |
|
90 | - * @param string $key |
|
91 | - * @return string |
|
92 | - */ |
|
93 | - function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
94 | - { |
|
95 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
96 | - } |
|
86 | + /** |
|
87 | + * @param string $message |
|
88 | + * @param string $assocData |
|
89 | + * @param string $nonce |
|
90 | + * @param string $key |
|
91 | + * @return string |
|
92 | + */ |
|
93 | + function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
94 | + { |
|
95 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | if (!is_callable('\\Sodium\\crypto_auth')) { |
99 | - /** |
|
100 | - * @param string $message |
|
101 | - * @param string $key |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - function crypto_auth($message, $key) |
|
105 | - { |
|
106 | - return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
107 | - } |
|
99 | + /** |
|
100 | + * @param string $message |
|
101 | + * @param string $key |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + function crypto_auth($message, $key) |
|
105 | + { |
|
106 | + return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | if (!is_callable('\\Sodium\\crypto_auth_verify')) { |
110 | - /** |
|
111 | - * @param string $mac |
|
112 | - * @param string $message |
|
113 | - * @param string $key |
|
114 | - * @return bool |
|
115 | - */ |
|
116 | - function crypto_auth_verify($mac, $message, $key) |
|
117 | - { |
|
118 | - return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
119 | - } |
|
110 | + /** |
|
111 | + * @param string $mac |
|
112 | + * @param string $message |
|
113 | + * @param string $key |
|
114 | + * @return bool |
|
115 | + */ |
|
116 | + function crypto_auth_verify($mac, $message, $key) |
|
117 | + { |
|
118 | + return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
119 | + } |
|
120 | 120 | } |
121 | 121 | if (!is_callable('\\Sodium\\crypto_box')) { |
122 | - /** |
|
123 | - * @param string $message |
|
124 | - * @param string $nonce |
|
125 | - * @param string $kp |
|
126 | - * @return string |
|
127 | - */ |
|
128 | - function crypto_box($message, $nonce, $kp) |
|
129 | - { |
|
130 | - return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
131 | - } |
|
122 | + /** |
|
123 | + * @param string $message |
|
124 | + * @param string $nonce |
|
125 | + * @param string $kp |
|
126 | + * @return string |
|
127 | + */ |
|
128 | + function crypto_box($message, $nonce, $kp) |
|
129 | + { |
|
130 | + return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
131 | + } |
|
132 | 132 | } |
133 | 133 | if (!is_callable('\\Sodium\\crypto_box_keypair')) { |
134 | - /** |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - function crypto_box_keypair() |
|
138 | - { |
|
139 | - return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
|
140 | - } |
|
134 | + /** |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + function crypto_box_keypair() |
|
138 | + { |
|
139 | + return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
|
140 | + } |
|
141 | 141 | } |
142 | 142 | if (!is_callable('\\Sodium\\crypto_box_keypair_from_secretkey_and_publickey')) { |
143 | - /** |
|
144 | - * @param string $sk |
|
145 | - * @param string $pk |
|
146 | - * @return string |
|
147 | - */ |
|
148 | - function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
149 | - { |
|
150 | - return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
151 | - } |
|
143 | + /** |
|
144 | + * @param string $sk |
|
145 | + * @param string $pk |
|
146 | + * @return string |
|
147 | + */ |
|
148 | + function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
149 | + { |
|
150 | + return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
151 | + } |
|
152 | 152 | } |
153 | 153 | if (!is_callable('\\Sodium\\crypto_box_open')) { |
154 | - /** |
|
155 | - * @param string $message |
|
156 | - * @param string $nonce |
|
157 | - * @param string $kp |
|
158 | - * @return string|bool |
|
159 | - */ |
|
160 | - function crypto_box_open($message, $nonce, $kp) |
|
161 | - { |
|
162 | - try { |
|
163 | - return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
164 | - } catch (Error $ex) { |
|
165 | - return false; |
|
166 | - } catch (Exception $ex) { |
|
167 | - return false; |
|
168 | - } |
|
169 | - } |
|
154 | + /** |
|
155 | + * @param string $message |
|
156 | + * @param string $nonce |
|
157 | + * @param string $kp |
|
158 | + * @return string|bool |
|
159 | + */ |
|
160 | + function crypto_box_open($message, $nonce, $kp) |
|
161 | + { |
|
162 | + try { |
|
163 | + return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
164 | + } catch (Error $ex) { |
|
165 | + return false; |
|
166 | + } catch (Exception $ex) { |
|
167 | + return false; |
|
168 | + } |
|
169 | + } |
|
170 | 170 | } |
171 | 171 | if (!is_callable('\\Sodium\\crypto_box_publickey')) { |
172 | - /** |
|
173 | - * @param string $keypair |
|
174 | - * @return string |
|
175 | - */ |
|
176 | - function crypto_box_publickey($keypair) |
|
177 | - { |
|
178 | - return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
179 | - } |
|
172 | + /** |
|
173 | + * @param string $keypair |
|
174 | + * @return string |
|
175 | + */ |
|
176 | + function crypto_box_publickey($keypair) |
|
177 | + { |
|
178 | + return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
179 | + } |
|
180 | 180 | } |
181 | 181 | if (!is_callable('\\Sodium\\crypto_box_publickey_from_secretkey')) { |
182 | - /** |
|
183 | - * @param string $sk |
|
184 | - * @return string |
|
185 | - */ |
|
186 | - function crypto_box_publickey_from_secretkey($sk) |
|
187 | - { |
|
188 | - return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
189 | - } |
|
182 | + /** |
|
183 | + * @param string $sk |
|
184 | + * @return string |
|
185 | + */ |
|
186 | + function crypto_box_publickey_from_secretkey($sk) |
|
187 | + { |
|
188 | + return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
189 | + } |
|
190 | 190 | } |
191 | 191 | if (!is_callable('\\Sodium\\crypto_box_seal')) { |
192 | - /** |
|
193 | - * @param string $message |
|
194 | - * @param string $publicKey |
|
195 | - * @return string |
|
196 | - */ |
|
197 | - function crypto_box_seal($message, $publicKey) |
|
198 | - { |
|
199 | - return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
200 | - } |
|
192 | + /** |
|
193 | + * @param string $message |
|
194 | + * @param string $publicKey |
|
195 | + * @return string |
|
196 | + */ |
|
197 | + function crypto_box_seal($message, $publicKey) |
|
198 | + { |
|
199 | + return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
200 | + } |
|
201 | 201 | } |
202 | 202 | if (!is_callable('\\Sodium\\crypto_box_seal_open')) { |
203 | - /** |
|
204 | - * @param string $message |
|
205 | - * @param string $kp |
|
206 | - * @return string|bool |
|
207 | - */ |
|
208 | - function crypto_box_seal_open($message, $kp) |
|
209 | - { |
|
210 | - try { |
|
211 | - return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
212 | - } catch (\Error $ex) { |
|
213 | - return false; |
|
214 | - } catch (\Exception $ex) { |
|
215 | - return false; |
|
216 | - } |
|
217 | - } |
|
203 | + /** |
|
204 | + * @param string $message |
|
205 | + * @param string $kp |
|
206 | + * @return string|bool |
|
207 | + */ |
|
208 | + function crypto_box_seal_open($message, $kp) |
|
209 | + { |
|
210 | + try { |
|
211 | + return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
212 | + } catch (\Error $ex) { |
|
213 | + return false; |
|
214 | + } catch (\Exception $ex) { |
|
215 | + return false; |
|
216 | + } |
|
217 | + } |
|
218 | 218 | } |
219 | 219 | if (!is_callable('\\Sodium\\crypto_box_secretkey')) { |
220 | - /** |
|
221 | - * @param string $keypair |
|
222 | - * @return string |
|
223 | - */ |
|
224 | - function crypto_box_secretkey($keypair) |
|
225 | - { |
|
226 | - return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
227 | - } |
|
220 | + /** |
|
221 | + * @param string $keypair |
|
222 | + * @return string |
|
223 | + */ |
|
224 | + function crypto_box_secretkey($keypair) |
|
225 | + { |
|
226 | + return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
227 | + } |
|
228 | 228 | } |
229 | 229 | if (!is_callable('\\Sodium\\crypto_generichash')) { |
230 | - /** |
|
231 | - * @param string $message |
|
232 | - * @param string|null $key |
|
233 | - * @param int $outLen |
|
234 | - * @return string |
|
235 | - */ |
|
236 | - function crypto_generichash($message, $key = null, $outLen = 32) |
|
237 | - { |
|
238 | - return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
239 | - } |
|
230 | + /** |
|
231 | + * @param string $message |
|
232 | + * @param string|null $key |
|
233 | + * @param int $outLen |
|
234 | + * @return string |
|
235 | + */ |
|
236 | + function crypto_generichash($message, $key = null, $outLen = 32) |
|
237 | + { |
|
238 | + return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
239 | + } |
|
240 | 240 | } |
241 | 241 | if (!is_callable('\\Sodium\\crypto_generichash_final')) { |
242 | - /** |
|
243 | - * @param string|null $ctx |
|
244 | - * @param int $outputLength |
|
245 | - * @return string |
|
246 | - */ |
|
247 | - function crypto_generichash_final(&$ctx, $outputLength = 32) |
|
248 | - { |
|
249 | - return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
250 | - } |
|
242 | + /** |
|
243 | + * @param string|null $ctx |
|
244 | + * @param int $outputLength |
|
245 | + * @return string |
|
246 | + */ |
|
247 | + function crypto_generichash_final(&$ctx, $outputLength = 32) |
|
248 | + { |
|
249 | + return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
250 | + } |
|
251 | 251 | } |
252 | 252 | if (!is_callable('\\Sodium\\crypto_generichash_init')) { |
253 | - /** |
|
254 | - * @param string|null $key |
|
255 | - * @param int $outLen |
|
256 | - * @return string |
|
257 | - */ |
|
258 | - function crypto_generichash_init($key = null, $outLen = 32) |
|
259 | - { |
|
260 | - return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
261 | - } |
|
253 | + /** |
|
254 | + * @param string|null $key |
|
255 | + * @param int $outLen |
|
256 | + * @return string |
|
257 | + */ |
|
258 | + function crypto_generichash_init($key = null, $outLen = 32) |
|
259 | + { |
|
260 | + return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
261 | + } |
|
262 | 262 | } |
263 | 263 | if (!is_callable('\\Sodium\\crypto_generichash_update')) { |
264 | - /** |
|
265 | - * @param string|null $ctx |
|
266 | - * @param string $message |
|
267 | - * @return void |
|
268 | - */ |
|
269 | - function crypto_generichash_update(&$ctx, $message = '') |
|
270 | - { |
|
271 | - ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
272 | - } |
|
264 | + /** |
|
265 | + * @param string|null $ctx |
|
266 | + * @param string $message |
|
267 | + * @return void |
|
268 | + */ |
|
269 | + function crypto_generichash_update(&$ctx, $message = '') |
|
270 | + { |
|
271 | + ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
272 | + } |
|
273 | 273 | } |
274 | 274 | if (!is_callable('\\Sodium\\crypto_kx')) { |
275 | - /** |
|
276 | - * @param string $my_secret |
|
277 | - * @param string $their_public |
|
278 | - * @param string $client_public |
|
279 | - * @param string $server_public |
|
280 | - * @return string |
|
281 | - */ |
|
282 | - function crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
283 | - { |
|
284 | - return ParagonIE_Sodium_Compat::crypto_kx( |
|
285 | - $my_secret, |
|
286 | - $their_public, |
|
287 | - $client_public, |
|
288 | - $server_public |
|
289 | - ); |
|
290 | - } |
|
275 | + /** |
|
276 | + * @param string $my_secret |
|
277 | + * @param string $their_public |
|
278 | + * @param string $client_public |
|
279 | + * @param string $server_public |
|
280 | + * @return string |
|
281 | + */ |
|
282 | + function crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
283 | + { |
|
284 | + return ParagonIE_Sodium_Compat::crypto_kx( |
|
285 | + $my_secret, |
|
286 | + $their_public, |
|
287 | + $client_public, |
|
288 | + $server_public |
|
289 | + ); |
|
290 | + } |
|
291 | 291 | } |
292 | 292 | if (!is_callable('\\Sodium\\crypto_pwhash')) { |
293 | - /** |
|
294 | - * @param int $outlen |
|
295 | - * @param string $passwd |
|
296 | - * @param string $salt |
|
297 | - * @param int $opslimit |
|
298 | - * @param int $memlimit |
|
299 | - * @return string |
|
300 | - */ |
|
301 | - function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
302 | - { |
|
303 | - return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
304 | - } |
|
293 | + /** |
|
294 | + * @param int $outlen |
|
295 | + * @param string $passwd |
|
296 | + * @param string $salt |
|
297 | + * @param int $opslimit |
|
298 | + * @param int $memlimit |
|
299 | + * @return string |
|
300 | + */ |
|
301 | + function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
302 | + { |
|
303 | + return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
304 | + } |
|
305 | 305 | } |
306 | 306 | if (!is_callable('\\Sodium\\crypto_pwhash_str')) { |
307 | - /** |
|
308 | - * @param string $passwd |
|
309 | - * @param int $opslimit |
|
310 | - * @param int $memlimit |
|
311 | - * @return string |
|
312 | - */ |
|
313 | - function crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
314 | - { |
|
315 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
316 | - } |
|
307 | + /** |
|
308 | + * @param string $passwd |
|
309 | + * @param int $opslimit |
|
310 | + * @param int $memlimit |
|
311 | + * @return string |
|
312 | + */ |
|
313 | + function crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
314 | + { |
|
315 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
316 | + } |
|
317 | 317 | } |
318 | 318 | if (!is_callable('\\Sodium\\crypto_pwhash_str_verify')) { |
319 | - /** |
|
320 | - * @param string $passwd |
|
321 | - * @param string $hash |
|
322 | - * @return bool |
|
323 | - */ |
|
324 | - function crypto_pwhash_str_verify($passwd, $hash) |
|
325 | - { |
|
326 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
327 | - } |
|
319 | + /** |
|
320 | + * @param string $passwd |
|
321 | + * @param string $hash |
|
322 | + * @return bool |
|
323 | + */ |
|
324 | + function crypto_pwhash_str_verify($passwd, $hash) |
|
325 | + { |
|
326 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
327 | + } |
|
328 | 328 | } |
329 | 329 | if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256')) { |
330 | - /** |
|
331 | - * @param int $outlen |
|
332 | - * @param string $passwd |
|
333 | - * @param string $salt |
|
334 | - * @param int $opslimit |
|
335 | - * @param int $memlimit |
|
336 | - * @return string |
|
337 | - */ |
|
338 | - function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
339 | - { |
|
340 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
341 | - } |
|
330 | + /** |
|
331 | + * @param int $outlen |
|
332 | + * @param string $passwd |
|
333 | + * @param string $salt |
|
334 | + * @param int $opslimit |
|
335 | + * @param int $memlimit |
|
336 | + * @return string |
|
337 | + */ |
|
338 | + function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
339 | + { |
|
340 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
341 | + } |
|
342 | 342 | } |
343 | 343 | if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str')) { |
344 | - /** |
|
345 | - * @param string $passwd |
|
346 | - * @param int $opslimit |
|
347 | - * @param int $memlimit |
|
348 | - * @return string |
|
349 | - */ |
|
350 | - function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
351 | - { |
|
352 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
353 | - } |
|
344 | + /** |
|
345 | + * @param string $passwd |
|
346 | + * @param int $opslimit |
|
347 | + * @param int $memlimit |
|
348 | + * @return string |
|
349 | + */ |
|
350 | + function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
351 | + { |
|
352 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
353 | + } |
|
354 | 354 | } |
355 | 355 | if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str_verify')) { |
356 | - /** |
|
357 | - * @param string $passwd |
|
358 | - * @param string $hash |
|
359 | - * @return bool |
|
360 | - */ |
|
361 | - function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
362 | - { |
|
363 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
364 | - } |
|
356 | + /** |
|
357 | + * @param string $passwd |
|
358 | + * @param string $hash |
|
359 | + * @return bool |
|
360 | + */ |
|
361 | + function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
362 | + { |
|
363 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
364 | + } |
|
365 | 365 | } |
366 | 366 | if (!is_callable('\\Sodium\\crypto_scalarmult')) { |
367 | - /** |
|
368 | - * @param string $n |
|
369 | - * @param string $p |
|
370 | - * @return string |
|
371 | - */ |
|
372 | - function crypto_scalarmult($n, $p) |
|
373 | - { |
|
374 | - return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
375 | - } |
|
367 | + /** |
|
368 | + * @param string $n |
|
369 | + * @param string $p |
|
370 | + * @return string |
|
371 | + */ |
|
372 | + function crypto_scalarmult($n, $p) |
|
373 | + { |
|
374 | + return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
375 | + } |
|
376 | 376 | } |
377 | 377 | if (!is_callable('\\Sodium\\crypto_scalarmult_base')) { |
378 | - /** |
|
379 | - * @param string $n |
|
380 | - * @return string |
|
381 | - */ |
|
382 | - function crypto_scalarmult_base($n) |
|
383 | - { |
|
384 | - return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
385 | - } |
|
378 | + /** |
|
379 | + * @param string $n |
|
380 | + * @return string |
|
381 | + */ |
|
382 | + function crypto_scalarmult_base($n) |
|
383 | + { |
|
384 | + return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | if (!is_callable('\\Sodium\\crypto_secretbox')) { |
388 | - /** |
|
389 | - * @param string $message |
|
390 | - * @param string $nonce |
|
391 | - * @param string $key |
|
392 | - * @return string |
|
393 | - */ |
|
394 | - function crypto_secretbox($message, $nonce, $key) |
|
395 | - { |
|
396 | - return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
397 | - } |
|
388 | + /** |
|
389 | + * @param string $message |
|
390 | + * @param string $nonce |
|
391 | + * @param string $key |
|
392 | + * @return string |
|
393 | + */ |
|
394 | + function crypto_secretbox($message, $nonce, $key) |
|
395 | + { |
|
396 | + return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
397 | + } |
|
398 | 398 | } |
399 | 399 | if (!is_callable('\\Sodium\\crypto_secretbox_open')) { |
400 | - /** |
|
401 | - * @param string $message |
|
402 | - * @param string $nonce |
|
403 | - * @param string $key |
|
404 | - * @return string|bool |
|
405 | - */ |
|
406 | - function crypto_secretbox_open($message, $nonce, $key) |
|
407 | - { |
|
408 | - try { |
|
409 | - return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
410 | - } catch (Error $ex) { |
|
411 | - return false; |
|
412 | - } catch (Exception $ex) { |
|
413 | - return false; |
|
414 | - } |
|
415 | - } |
|
400 | + /** |
|
401 | + * @param string $message |
|
402 | + * @param string $nonce |
|
403 | + * @param string $key |
|
404 | + * @return string|bool |
|
405 | + */ |
|
406 | + function crypto_secretbox_open($message, $nonce, $key) |
|
407 | + { |
|
408 | + try { |
|
409 | + return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
410 | + } catch (Error $ex) { |
|
411 | + return false; |
|
412 | + } catch (Exception $ex) { |
|
413 | + return false; |
|
414 | + } |
|
415 | + } |
|
416 | 416 | } |
417 | 417 | if (!is_callable('\\Sodium\\crypto_shorthash')) { |
418 | - /** |
|
419 | - * @param string $message |
|
420 | - * @param string $key |
|
421 | - * @return string |
|
422 | - */ |
|
423 | - function crypto_shorthash($message, $key = '') |
|
424 | - { |
|
425 | - return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
426 | - } |
|
418 | + /** |
|
419 | + * @param string $message |
|
420 | + * @param string $key |
|
421 | + * @return string |
|
422 | + */ |
|
423 | + function crypto_shorthash($message, $key = '') |
|
424 | + { |
|
425 | + return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
426 | + } |
|
427 | 427 | } |
428 | 428 | if (!is_callable('\\Sodium\\crypto_sign')) { |
429 | - /** |
|
430 | - * @param string $message |
|
431 | - * @param string $sk |
|
432 | - * @return string |
|
433 | - */ |
|
434 | - function crypto_sign($message, $sk) |
|
435 | - { |
|
436 | - return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
437 | - } |
|
429 | + /** |
|
430 | + * @param string $message |
|
431 | + * @param string $sk |
|
432 | + * @return string |
|
433 | + */ |
|
434 | + function crypto_sign($message, $sk) |
|
435 | + { |
|
436 | + return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
437 | + } |
|
438 | 438 | } |
439 | 439 | if (!is_callable('\\Sodium\\crypto_sign_detached')) { |
440 | - /** |
|
441 | - * @param string $message |
|
442 | - * @param string $sk |
|
443 | - * @return string |
|
444 | - */ |
|
445 | - function crypto_sign_detached($message, $sk) |
|
446 | - { |
|
447 | - return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
448 | - } |
|
440 | + /** |
|
441 | + * @param string $message |
|
442 | + * @param string $sk |
|
443 | + * @return string |
|
444 | + */ |
|
445 | + function crypto_sign_detached($message, $sk) |
|
446 | + { |
|
447 | + return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
448 | + } |
|
449 | 449 | } |
450 | 450 | if (!is_callable('\\Sodium\\crypto_sign_keypair')) { |
451 | - /** |
|
452 | - * @return string |
|
453 | - */ |
|
454 | - function crypto_sign_keypair() |
|
455 | - { |
|
456 | - return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
|
457 | - } |
|
451 | + /** |
|
452 | + * @return string |
|
453 | + */ |
|
454 | + function crypto_sign_keypair() |
|
455 | + { |
|
456 | + return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
|
457 | + } |
|
458 | 458 | } |
459 | 459 | if (!is_callable('\\Sodium\\crypto_sign_open')) { |
460 | - /** |
|
461 | - * @param string $signedMessage |
|
462 | - * @param string $pk |
|
463 | - * @return string|bool |
|
464 | - */ |
|
465 | - function crypto_sign_open($signedMessage, $pk) |
|
466 | - { |
|
467 | - try { |
|
468 | - return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
469 | - } catch (\Error $ex) { |
|
470 | - return false; |
|
471 | - } catch (\Exception $ex) { |
|
472 | - return false; |
|
473 | - } |
|
474 | - } |
|
460 | + /** |
|
461 | + * @param string $signedMessage |
|
462 | + * @param string $pk |
|
463 | + * @return string|bool |
|
464 | + */ |
|
465 | + function crypto_sign_open($signedMessage, $pk) |
|
466 | + { |
|
467 | + try { |
|
468 | + return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
469 | + } catch (\Error $ex) { |
|
470 | + return false; |
|
471 | + } catch (\Exception $ex) { |
|
472 | + return false; |
|
473 | + } |
|
474 | + } |
|
475 | 475 | } |
476 | 476 | if (!is_callable('\\Sodium\\crypto_sign_publickey')) { |
477 | - /** |
|
478 | - * @param string $keypair |
|
479 | - * @return string |
|
480 | - */ |
|
481 | - function crypto_sign_publickey($keypair) |
|
482 | - { |
|
483 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
484 | - } |
|
477 | + /** |
|
478 | + * @param string $keypair |
|
479 | + * @return string |
|
480 | + */ |
|
481 | + function crypto_sign_publickey($keypair) |
|
482 | + { |
|
483 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
484 | + } |
|
485 | 485 | } |
486 | 486 | if (!is_callable('\\Sodium\\crypto_sign_publickey_from_secretkey')) { |
487 | - /** |
|
488 | - * @param string $sk |
|
489 | - * @return string |
|
490 | - */ |
|
491 | - function crypto_sign_publickey_from_secretkey($sk) |
|
492 | - { |
|
493 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
494 | - } |
|
487 | + /** |
|
488 | + * @param string $sk |
|
489 | + * @return string |
|
490 | + */ |
|
491 | + function crypto_sign_publickey_from_secretkey($sk) |
|
492 | + { |
|
493 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
494 | + } |
|
495 | 495 | } |
496 | 496 | if (!is_callable('\\Sodium\\crypto_sign_secretkey')) { |
497 | - /** |
|
498 | - * @param string $keypair |
|
499 | - * @return string |
|
500 | - */ |
|
501 | - function crypto_sign_secretkey($keypair) |
|
502 | - { |
|
503 | - return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
504 | - } |
|
497 | + /** |
|
498 | + * @param string $keypair |
|
499 | + * @return string |
|
500 | + */ |
|
501 | + function crypto_sign_secretkey($keypair) |
|
502 | + { |
|
503 | + return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
504 | + } |
|
505 | 505 | } |
506 | 506 | if (!is_callable('\\Sodium\\crypto_sign_seed_keypair')) { |
507 | - /** |
|
508 | - * @param string $seed |
|
509 | - * @return string |
|
510 | - */ |
|
511 | - function crypto_sign_seed_keypair($seed) |
|
512 | - { |
|
513 | - return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
514 | - } |
|
507 | + /** |
|
508 | + * @param string $seed |
|
509 | + * @return string |
|
510 | + */ |
|
511 | + function crypto_sign_seed_keypair($seed) |
|
512 | + { |
|
513 | + return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
514 | + } |
|
515 | 515 | } |
516 | 516 | if (!is_callable('\\Sodium\\crypto_sign_verify_detached')) { |
517 | - /** |
|
518 | - * @param string $signature |
|
519 | - * @param string $message |
|
520 | - * @param string $pk |
|
521 | - * @return bool |
|
522 | - */ |
|
523 | - function crypto_sign_verify_detached($signature, $message, $pk) |
|
524 | - { |
|
525 | - return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
526 | - } |
|
517 | + /** |
|
518 | + * @param string $signature |
|
519 | + * @param string $message |
|
520 | + * @param string $pk |
|
521 | + * @return bool |
|
522 | + */ |
|
523 | + function crypto_sign_verify_detached($signature, $message, $pk) |
|
524 | + { |
|
525 | + return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
526 | + } |
|
527 | 527 | } |
528 | 528 | if (!is_callable('\\Sodium\\crypto_sign_ed25519_sk_to_curve25519')) { |
529 | - /** |
|
530 | - * @param string $sk |
|
531 | - * @return string |
|
532 | - */ |
|
533 | - function crypto_sign_ed25519_sk_to_curve25519($sk) |
|
534 | - { |
|
535 | - return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
|
536 | - } |
|
529 | + /** |
|
530 | + * @param string $sk |
|
531 | + * @return string |
|
532 | + */ |
|
533 | + function crypto_sign_ed25519_sk_to_curve25519($sk) |
|
534 | + { |
|
535 | + return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
|
536 | + } |
|
537 | 537 | } |
538 | 538 | if (!is_callable('\\Sodium\\crypto_stream')) { |
539 | - /** |
|
540 | - * @param int $len |
|
541 | - * @param string $nonce |
|
542 | - * @param string $key |
|
543 | - * @return string |
|
544 | - */ |
|
545 | - function crypto_stream($len, $nonce, $key) |
|
546 | - { |
|
547 | - return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
548 | - } |
|
539 | + /** |
|
540 | + * @param int $len |
|
541 | + * @param string $nonce |
|
542 | + * @param string $key |
|
543 | + * @return string |
|
544 | + */ |
|
545 | + function crypto_stream($len, $nonce, $key) |
|
546 | + { |
|
547 | + return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
548 | + } |
|
549 | 549 | } |
550 | 550 | if (!is_callable('\\Sodium\\crypto_stream_xor')) { |
551 | - /** |
|
552 | - * @param string $message |
|
553 | - * @param string $nonce |
|
554 | - * @param string $key |
|
555 | - * @return string |
|
556 | - */ |
|
557 | - function crypto_stream_xor($message, $nonce, $key) |
|
558 | - { |
|
559 | - return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
560 | - } |
|
551 | + /** |
|
552 | + * @param string $message |
|
553 | + * @param string $nonce |
|
554 | + * @param string $key |
|
555 | + * @return string |
|
556 | + */ |
|
557 | + function crypto_stream_xor($message, $nonce, $key) |
|
558 | + { |
|
559 | + return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
560 | + } |
|
561 | 561 | } |
562 | 562 | if (!is_callable('\\Sodium\\hex2bin')) { |
563 | - /** |
|
564 | - * @param string $string |
|
565 | - * @return string |
|
566 | - */ |
|
567 | - function hex2bin($string) |
|
568 | - { |
|
569 | - return ParagonIE_Sodium_Compat::hex2bin($string); |
|
570 | - } |
|
563 | + /** |
|
564 | + * @param string $string |
|
565 | + * @return string |
|
566 | + */ |
|
567 | + function hex2bin($string) |
|
568 | + { |
|
569 | + return ParagonIE_Sodium_Compat::hex2bin($string); |
|
570 | + } |
|
571 | 571 | } |
572 | 572 | if (!is_callable('\\Sodium\\memcmp')) { |
573 | - /** |
|
574 | - * @param string $a |
|
575 | - * @param string $b |
|
576 | - * @return int |
|
577 | - */ |
|
578 | - function memcmp($a, $b) |
|
579 | - { |
|
580 | - return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
581 | - } |
|
573 | + /** |
|
574 | + * @param string $a |
|
575 | + * @param string $b |
|
576 | + * @return int |
|
577 | + */ |
|
578 | + function memcmp($a, $b) |
|
579 | + { |
|
580 | + return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
581 | + } |
|
582 | 582 | } |
583 | 583 | if (!is_callable('\\Sodium\\memzero')) { |
584 | - /** |
|
585 | - * @param string $str |
|
586 | - * @return void |
|
587 | - */ |
|
588 | - function memzero(&$str) |
|
589 | - { |
|
590 | - ParagonIE_Sodium_Compat::memzero($str); |
|
591 | - } |
|
584 | + /** |
|
585 | + * @param string $str |
|
586 | + * @return void |
|
587 | + */ |
|
588 | + function memzero(&$str) |
|
589 | + { |
|
590 | + ParagonIE_Sodium_Compat::memzero($str); |
|
591 | + } |
|
592 | 592 | } |
593 | 593 | if (!is_callable('\\Sodium\\randombytes_buf')) { |
594 | - /** |
|
595 | - * @param int $amount |
|
596 | - * @return string |
|
597 | - */ |
|
598 | - function randombytes_buf($amount) |
|
599 | - { |
|
600 | - return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
601 | - } |
|
594 | + /** |
|
595 | + * @param int $amount |
|
596 | + * @return string |
|
597 | + */ |
|
598 | + function randombytes_buf($amount) |
|
599 | + { |
|
600 | + return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
601 | + } |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | if (!is_callable('\\Sodium\\randombytes_uniform')) { |
605 | - /** |
|
606 | - * @param int $upperLimit |
|
607 | - * @return int |
|
608 | - */ |
|
609 | - function randombytes_uniform($upperLimit) |
|
610 | - { |
|
611 | - return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
612 | - } |
|
605 | + /** |
|
606 | + * @param int $upperLimit |
|
607 | + * @return int |
|
608 | + */ |
|
609 | + function randombytes_uniform($upperLimit) |
|
610 | + { |
|
611 | + return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
612 | + } |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | if (!is_callable('\\Sodium\\randombytes_random16')) { |
616 | - /** |
|
617 | - * @return int |
|
618 | - */ |
|
619 | - function randombytes_random16() |
|
620 | - { |
|
621 | - return ParagonIE_Sodium_Compat::randombytes_random16(); |
|
622 | - } |
|
616 | + /** |
|
617 | + * @return int |
|
618 | + */ |
|
619 | + function randombytes_random16() |
|
620 | + { |
|
621 | + return ParagonIE_Sodium_Compat::randombytes_random16(); |
|
622 | + } |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | if (!defined('\\Sodium\\CRYPTO_AUTH_BYTES')) { |
626 | - require_once dirname(__FILE__) . '/constants.php'; |
|
626 | + require_once dirname(__FILE__) . '/constants.php'; |
|
627 | 627 | } |
@@ -10,28 +10,28 @@ discard block |
||
10 | 10 | * Thus, the functions just proxy to the appropriate ParagonIE_Sodium_Compat |
11 | 11 | * method. |
12 | 12 | */ |
13 | -if (!is_callable('\\Sodium\\bin2hex')) { |
|
13 | +if ( ! is_callable( '\\Sodium\\bin2hex' ) ) { |
|
14 | 14 | /** |
15 | 15 | * @param string $string |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - function bin2hex($string) |
|
18 | + function bin2hex( $string ) |
|
19 | 19 | { |
20 | - return ParagonIE_Sodium_Compat::bin2hex($string); |
|
20 | + return ParagonIE_Sodium_Compat::bin2hex( $string ); |
|
21 | 21 | } |
22 | 22 | } |
23 | -if (!is_callable('\\Sodium\\compare')) { |
|
23 | +if ( ! is_callable( '\\Sodium\\compare' ) ) { |
|
24 | 24 | /** |
25 | 25 | * @param string $a |
26 | 26 | * @param string $b |
27 | 27 | * @return int |
28 | 28 | */ |
29 | - function compare($a, $b) |
|
29 | + function compare( $a, $b ) |
|
30 | 30 | { |
31 | - return ParagonIE_Sodium_Compat::compare($a, $b); |
|
31 | + return ParagonIE_Sodium_Compat::compare( $a, $b ); |
|
32 | 32 | } |
33 | 33 | } |
34 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_decrypt')) { |
|
34 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_decrypt' ) ) { |
|
35 | 35 | /** |
36 | 36 | * @param string $message |
37 | 37 | * @param string $assocData |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | * @param string $key |
40 | 40 | * @return string|bool |
41 | 41 | */ |
42 | - function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
42 | + function crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ) |
|
43 | 43 | { |
44 | 44 | try { |
45 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
46 | - } catch (Error $ex) { |
|
45 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ); |
|
46 | + } catch ( Error $ex ) { |
|
47 | 47 | return false; |
48 | - } catch (Exception $ex) { |
|
48 | + } catch ( Exception $ex ) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
53 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_encrypt')) { |
|
53 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_encrypt' ) ) { |
|
54 | 54 | /** |
55 | 55 | * @param string $message |
56 | 56 | * @param string $assocData |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * @param string $key |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
61 | + function crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ) |
|
62 | 62 | { |
63 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
63 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ); |
|
64 | 64 | } |
65 | 65 | } |
66 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_decrypt')) { |
|
66 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_ietf_decrypt' ) ) { |
|
67 | 67 | /** |
68 | 68 | * @param string $message |
69 | 69 | * @param string $assocData |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | * @param string $key |
72 | 72 | * @return string|bool |
73 | 73 | */ |
74 | - function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
74 | + function crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ) |
|
75 | 75 | { |
76 | 76 | try { |
77 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
78 | - } catch (Error $ex) { |
|
77 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ); |
|
78 | + } catch ( Error $ex ) { |
|
79 | 79 | return false; |
80 | - } catch (Exception $ex) { |
|
80 | + } catch ( Exception $ex ) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_encrypt')) { |
|
85 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_ietf_encrypt' ) ) { |
|
86 | 86 | /** |
87 | 87 | * @param string $message |
88 | 88 | * @param string $assocData |
@@ -90,47 +90,47 @@ discard block |
||
90 | 90 | * @param string $key |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
93 | + function crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ) |
|
94 | 94 | { |
95 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
95 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ); |
|
96 | 96 | } |
97 | 97 | } |
98 | -if (!is_callable('\\Sodium\\crypto_auth')) { |
|
98 | +if ( ! is_callable( '\\Sodium\\crypto_auth' ) ) { |
|
99 | 99 | /** |
100 | 100 | * @param string $message |
101 | 101 | * @param string $key |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - function crypto_auth($message, $key) |
|
104 | + function crypto_auth( $message, $key ) |
|
105 | 105 | { |
106 | - return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
106 | + return ParagonIE_Sodium_Compat::crypto_auth( $message, $key ); |
|
107 | 107 | } |
108 | 108 | } |
109 | -if (!is_callable('\\Sodium\\crypto_auth_verify')) { |
|
109 | +if ( ! is_callable( '\\Sodium\\crypto_auth_verify' ) ) { |
|
110 | 110 | /** |
111 | 111 | * @param string $mac |
112 | 112 | * @param string $message |
113 | 113 | * @param string $key |
114 | 114 | * @return bool |
115 | 115 | */ |
116 | - function crypto_auth_verify($mac, $message, $key) |
|
116 | + function crypto_auth_verify( $mac, $message, $key ) |
|
117 | 117 | { |
118 | - return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
118 | + return ParagonIE_Sodium_Compat::crypto_auth_verify( $mac, $message, $key ); |
|
119 | 119 | } |
120 | 120 | } |
121 | -if (!is_callable('\\Sodium\\crypto_box')) { |
|
121 | +if ( ! is_callable( '\\Sodium\\crypto_box' ) ) { |
|
122 | 122 | /** |
123 | 123 | * @param string $message |
124 | 124 | * @param string $nonce |
125 | 125 | * @param string $kp |
126 | 126 | * @return string |
127 | 127 | */ |
128 | - function crypto_box($message, $nonce, $kp) |
|
128 | + function crypto_box( $message, $nonce, $kp ) |
|
129 | 129 | { |
130 | - return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
130 | + return ParagonIE_Sodium_Compat::crypto_box( $message, $nonce, $kp ); |
|
131 | 131 | } |
132 | 132 | } |
133 | -if (!is_callable('\\Sodium\\crypto_box_keypair')) { |
|
133 | +if ( ! is_callable( '\\Sodium\\crypto_box_keypair' ) ) { |
|
134 | 134 | /** |
135 | 135 | * @return string |
136 | 136 | */ |
@@ -139,139 +139,139 @@ discard block |
||
139 | 139 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
140 | 140 | } |
141 | 141 | } |
142 | -if (!is_callable('\\Sodium\\crypto_box_keypair_from_secretkey_and_publickey')) { |
|
142 | +if ( ! is_callable( '\\Sodium\\crypto_box_keypair_from_secretkey_and_publickey' ) ) { |
|
143 | 143 | /** |
144 | 144 | * @param string $sk |
145 | 145 | * @param string $pk |
146 | 146 | * @return string |
147 | 147 | */ |
148 | - function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
148 | + function crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ) |
|
149 | 149 | { |
150 | - return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
150 | + return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ); |
|
151 | 151 | } |
152 | 152 | } |
153 | -if (!is_callable('\\Sodium\\crypto_box_open')) { |
|
153 | +if ( ! is_callable( '\\Sodium\\crypto_box_open' ) ) { |
|
154 | 154 | /** |
155 | 155 | * @param string $message |
156 | 156 | * @param string $nonce |
157 | 157 | * @param string $kp |
158 | 158 | * @return string|bool |
159 | 159 | */ |
160 | - function crypto_box_open($message, $nonce, $kp) |
|
160 | + function crypto_box_open( $message, $nonce, $kp ) |
|
161 | 161 | { |
162 | 162 | try { |
163 | - return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
164 | - } catch (Error $ex) { |
|
163 | + return ParagonIE_Sodium_Compat::crypto_box_open( $message, $nonce, $kp ); |
|
164 | + } catch ( Error $ex ) { |
|
165 | 165 | return false; |
166 | - } catch (Exception $ex) { |
|
166 | + } catch ( Exception $ex ) { |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
171 | -if (!is_callable('\\Sodium\\crypto_box_publickey')) { |
|
171 | +if ( ! is_callable( '\\Sodium\\crypto_box_publickey' ) ) { |
|
172 | 172 | /** |
173 | 173 | * @param string $keypair |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - function crypto_box_publickey($keypair) |
|
176 | + function crypto_box_publickey( $keypair ) |
|
177 | 177 | { |
178 | - return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
178 | + return ParagonIE_Sodium_Compat::crypto_box_publickey( $keypair ); |
|
179 | 179 | } |
180 | 180 | } |
181 | -if (!is_callable('\\Sodium\\crypto_box_publickey_from_secretkey')) { |
|
181 | +if ( ! is_callable( '\\Sodium\\crypto_box_publickey_from_secretkey' ) ) { |
|
182 | 182 | /** |
183 | 183 | * @param string $sk |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - function crypto_box_publickey_from_secretkey($sk) |
|
186 | + function crypto_box_publickey_from_secretkey( $sk ) |
|
187 | 187 | { |
188 | - return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
188 | + return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey( $sk ); |
|
189 | 189 | } |
190 | 190 | } |
191 | -if (!is_callable('\\Sodium\\crypto_box_seal')) { |
|
191 | +if ( ! is_callable( '\\Sodium\\crypto_box_seal' ) ) { |
|
192 | 192 | /** |
193 | 193 | * @param string $message |
194 | 194 | * @param string $publicKey |
195 | 195 | * @return string |
196 | 196 | */ |
197 | - function crypto_box_seal($message, $publicKey) |
|
197 | + function crypto_box_seal( $message, $publicKey ) |
|
198 | 198 | { |
199 | - return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
199 | + return ParagonIE_Sodium_Compat::crypto_box_seal( $message, $publicKey ); |
|
200 | 200 | } |
201 | 201 | } |
202 | -if (!is_callable('\\Sodium\\crypto_box_seal_open')) { |
|
202 | +if ( ! is_callable( '\\Sodium\\crypto_box_seal_open' ) ) { |
|
203 | 203 | /** |
204 | 204 | * @param string $message |
205 | 205 | * @param string $kp |
206 | 206 | * @return string|bool |
207 | 207 | */ |
208 | - function crypto_box_seal_open($message, $kp) |
|
208 | + function crypto_box_seal_open( $message, $kp ) |
|
209 | 209 | { |
210 | 210 | try { |
211 | - return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
212 | - } catch (\Error $ex) { |
|
211 | + return ParagonIE_Sodium_Compat::crypto_box_seal_open( $message, $kp ); |
|
212 | + } catch ( \Error $ex ) { |
|
213 | 213 | return false; |
214 | - } catch (\Exception $ex) { |
|
214 | + } catch ( \Exception $ex ) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
219 | -if (!is_callable('\\Sodium\\crypto_box_secretkey')) { |
|
219 | +if ( ! is_callable( '\\Sodium\\crypto_box_secretkey' ) ) { |
|
220 | 220 | /** |
221 | 221 | * @param string $keypair |
222 | 222 | * @return string |
223 | 223 | */ |
224 | - function crypto_box_secretkey($keypair) |
|
224 | + function crypto_box_secretkey( $keypair ) |
|
225 | 225 | { |
226 | - return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
226 | + return ParagonIE_Sodium_Compat::crypto_box_secretkey( $keypair ); |
|
227 | 227 | } |
228 | 228 | } |
229 | -if (!is_callable('\\Sodium\\crypto_generichash')) { |
|
229 | +if ( ! is_callable( '\\Sodium\\crypto_generichash' ) ) { |
|
230 | 230 | /** |
231 | 231 | * @param string $message |
232 | 232 | * @param string|null $key |
233 | 233 | * @param int $outLen |
234 | 234 | * @return string |
235 | 235 | */ |
236 | - function crypto_generichash($message, $key = null, $outLen = 32) |
|
236 | + function crypto_generichash( $message, $key = null, $outLen = 32 ) |
|
237 | 237 | { |
238 | - return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
238 | + return ParagonIE_Sodium_Compat::crypto_generichash( $message, $key, $outLen ); |
|
239 | 239 | } |
240 | 240 | } |
241 | -if (!is_callable('\\Sodium\\crypto_generichash_final')) { |
|
241 | +if ( ! is_callable( '\\Sodium\\crypto_generichash_final' ) ) { |
|
242 | 242 | /** |
243 | 243 | * @param string|null $ctx |
244 | 244 | * @param int $outputLength |
245 | 245 | * @return string |
246 | 246 | */ |
247 | - function crypto_generichash_final(&$ctx, $outputLength = 32) |
|
247 | + function crypto_generichash_final( &$ctx, $outputLength = 32 ) |
|
248 | 248 | { |
249 | - return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
249 | + return ParagonIE_Sodium_Compat::crypto_generichash_final( $ctx, $outputLength ); |
|
250 | 250 | } |
251 | 251 | } |
252 | -if (!is_callable('\\Sodium\\crypto_generichash_init')) { |
|
252 | +if ( ! is_callable( '\\Sodium\\crypto_generichash_init' ) ) { |
|
253 | 253 | /** |
254 | 254 | * @param string|null $key |
255 | 255 | * @param int $outLen |
256 | 256 | * @return string |
257 | 257 | */ |
258 | - function crypto_generichash_init($key = null, $outLen = 32) |
|
258 | + function crypto_generichash_init( $key = null, $outLen = 32 ) |
|
259 | 259 | { |
260 | - return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
260 | + return ParagonIE_Sodium_Compat::crypto_generichash_init( $key, $outLen ); |
|
261 | 261 | } |
262 | 262 | } |
263 | -if (!is_callable('\\Sodium\\crypto_generichash_update')) { |
|
263 | +if ( ! is_callable( '\\Sodium\\crypto_generichash_update' ) ) { |
|
264 | 264 | /** |
265 | 265 | * @param string|null $ctx |
266 | 266 | * @param string $message |
267 | 267 | * @return void |
268 | 268 | */ |
269 | - function crypto_generichash_update(&$ctx, $message = '') |
|
269 | + function crypto_generichash_update( &$ctx, $message = '' ) |
|
270 | 270 | { |
271 | - ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
271 | + ParagonIE_Sodium_Compat::crypto_generichash_update( $ctx, $message ); |
|
272 | 272 | } |
273 | 273 | } |
274 | -if (!is_callable('\\Sodium\\crypto_kx')) { |
|
274 | +if ( ! is_callable( '\\Sodium\\crypto_kx' ) ) { |
|
275 | 275 | /** |
276 | 276 | * @param string $my_secret |
277 | 277 | * @param string $their_public |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @param string $server_public |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - function crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
282 | + function crypto_kx( $my_secret, $their_public, $client_public, $server_public ) |
|
283 | 283 | { |
284 | 284 | return ParagonIE_Sodium_Compat::crypto_kx( |
285 | 285 | $my_secret, |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | ); |
290 | 290 | } |
291 | 291 | } |
292 | -if (!is_callable('\\Sodium\\crypto_pwhash')) { |
|
292 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash' ) ) { |
|
293 | 293 | /** |
294 | 294 | * @param int $outlen |
295 | 295 | * @param string $passwd |
@@ -298,35 +298,35 @@ discard block |
||
298 | 298 | * @param int $memlimit |
299 | 299 | * @return string |
300 | 300 | */ |
301 | - function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
301 | + function crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit ) |
|
302 | 302 | { |
303 | - return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
303 | + return ParagonIE_Sodium_Compat::crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit ); |
|
304 | 304 | } |
305 | 305 | } |
306 | -if (!is_callable('\\Sodium\\crypto_pwhash_str')) { |
|
306 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_str' ) ) { |
|
307 | 307 | /** |
308 | 308 | * @param string $passwd |
309 | 309 | * @param int $opslimit |
310 | 310 | * @param int $memlimit |
311 | 311 | * @return string |
312 | 312 | */ |
313 | - function crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
313 | + function crypto_pwhash_str( $passwd, $opslimit, $memlimit ) |
|
314 | 314 | { |
315 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
315 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str( $passwd, $opslimit, $memlimit ); |
|
316 | 316 | } |
317 | 317 | } |
318 | -if (!is_callable('\\Sodium\\crypto_pwhash_str_verify')) { |
|
318 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_str_verify' ) ) { |
|
319 | 319 | /** |
320 | 320 | * @param string $passwd |
321 | 321 | * @param string $hash |
322 | 322 | * @return bool |
323 | 323 | */ |
324 | - function crypto_pwhash_str_verify($passwd, $hash) |
|
324 | + function crypto_pwhash_str_verify( $passwd, $hash ) |
|
325 | 325 | { |
326 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
326 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify( $passwd, $hash ); |
|
327 | 327 | } |
328 | 328 | } |
329 | -if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256')) { |
|
329 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_scryptsalsa208sha256' ) ) { |
|
330 | 330 | /** |
331 | 331 | * @param int $outlen |
332 | 332 | * @param string $passwd |
@@ -335,119 +335,119 @@ discard block |
||
335 | 335 | * @param int $memlimit |
336 | 336 | * @return string |
337 | 337 | */ |
338 | - function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
338 | + function crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ) |
|
339 | 339 | { |
340 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
340 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ); |
|
341 | 341 | } |
342 | 342 | } |
343 | -if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str')) { |
|
343 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str' ) ) { |
|
344 | 344 | /** |
345 | 345 | * @param string $passwd |
346 | 346 | * @param int $opslimit |
347 | 347 | * @param int $memlimit |
348 | 348 | * @return string |
349 | 349 | */ |
350 | - function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
350 | + function crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ) |
|
351 | 351 | { |
352 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
352 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ); |
|
353 | 353 | } |
354 | 354 | } |
355 | -if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str_verify')) { |
|
355 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str_verify' ) ) { |
|
356 | 356 | /** |
357 | 357 | * @param string $passwd |
358 | 358 | * @param string $hash |
359 | 359 | * @return bool |
360 | 360 | */ |
361 | - function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
361 | + function crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ) |
|
362 | 362 | { |
363 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
363 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ); |
|
364 | 364 | } |
365 | 365 | } |
366 | -if (!is_callable('\\Sodium\\crypto_scalarmult')) { |
|
366 | +if ( ! is_callable( '\\Sodium\\crypto_scalarmult' ) ) { |
|
367 | 367 | /** |
368 | 368 | * @param string $n |
369 | 369 | * @param string $p |
370 | 370 | * @return string |
371 | 371 | */ |
372 | - function crypto_scalarmult($n, $p) |
|
372 | + function crypto_scalarmult( $n, $p ) |
|
373 | 373 | { |
374 | - return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
374 | + return ParagonIE_Sodium_Compat::crypto_scalarmult( $n, $p ); |
|
375 | 375 | } |
376 | 376 | } |
377 | -if (!is_callable('\\Sodium\\crypto_scalarmult_base')) { |
|
377 | +if ( ! is_callable( '\\Sodium\\crypto_scalarmult_base' ) ) { |
|
378 | 378 | /** |
379 | 379 | * @param string $n |
380 | 380 | * @return string |
381 | 381 | */ |
382 | - function crypto_scalarmult_base($n) |
|
382 | + function crypto_scalarmult_base( $n ) |
|
383 | 383 | { |
384 | - return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
384 | + return ParagonIE_Sodium_Compat::crypto_scalarmult_base( $n ); |
|
385 | 385 | } |
386 | 386 | } |
387 | -if (!is_callable('\\Sodium\\crypto_secretbox')) { |
|
387 | +if ( ! is_callable( '\\Sodium\\crypto_secretbox' ) ) { |
|
388 | 388 | /** |
389 | 389 | * @param string $message |
390 | 390 | * @param string $nonce |
391 | 391 | * @param string $key |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - function crypto_secretbox($message, $nonce, $key) |
|
394 | + function crypto_secretbox( $message, $nonce, $key ) |
|
395 | 395 | { |
396 | - return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
396 | + return ParagonIE_Sodium_Compat::crypto_secretbox( $message, $nonce, $key ); |
|
397 | 397 | } |
398 | 398 | } |
399 | -if (!is_callable('\\Sodium\\crypto_secretbox_open')) { |
|
399 | +if ( ! is_callable( '\\Sodium\\crypto_secretbox_open' ) ) { |
|
400 | 400 | /** |
401 | 401 | * @param string $message |
402 | 402 | * @param string $nonce |
403 | 403 | * @param string $key |
404 | 404 | * @return string|bool |
405 | 405 | */ |
406 | - function crypto_secretbox_open($message, $nonce, $key) |
|
406 | + function crypto_secretbox_open( $message, $nonce, $key ) |
|
407 | 407 | { |
408 | 408 | try { |
409 | - return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
410 | - } catch (Error $ex) { |
|
409 | + return ParagonIE_Sodium_Compat::crypto_secretbox_open( $message, $nonce, $key ); |
|
410 | + } catch ( Error $ex ) { |
|
411 | 411 | return false; |
412 | - } catch (Exception $ex) { |
|
412 | + } catch ( Exception $ex ) { |
|
413 | 413 | return false; |
414 | 414 | } |
415 | 415 | } |
416 | 416 | } |
417 | -if (!is_callable('\\Sodium\\crypto_shorthash')) { |
|
417 | +if ( ! is_callable( '\\Sodium\\crypto_shorthash' ) ) { |
|
418 | 418 | /** |
419 | 419 | * @param string $message |
420 | 420 | * @param string $key |
421 | 421 | * @return string |
422 | 422 | */ |
423 | - function crypto_shorthash($message, $key = '') |
|
423 | + function crypto_shorthash( $message, $key = '' ) |
|
424 | 424 | { |
425 | - return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
425 | + return ParagonIE_Sodium_Compat::crypto_shorthash( $message, $key ); |
|
426 | 426 | } |
427 | 427 | } |
428 | -if (!is_callable('\\Sodium\\crypto_sign')) { |
|
428 | +if ( ! is_callable( '\\Sodium\\crypto_sign' ) ) { |
|
429 | 429 | /** |
430 | 430 | * @param string $message |
431 | 431 | * @param string $sk |
432 | 432 | * @return string |
433 | 433 | */ |
434 | - function crypto_sign($message, $sk) |
|
434 | + function crypto_sign( $message, $sk ) |
|
435 | 435 | { |
436 | - return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
436 | + return ParagonIE_Sodium_Compat::crypto_sign( $message, $sk ); |
|
437 | 437 | } |
438 | 438 | } |
439 | -if (!is_callable('\\Sodium\\crypto_sign_detached')) { |
|
439 | +if ( ! is_callable( '\\Sodium\\crypto_sign_detached' ) ) { |
|
440 | 440 | /** |
441 | 441 | * @param string $message |
442 | 442 | * @param string $sk |
443 | 443 | * @return string |
444 | 444 | */ |
445 | - function crypto_sign_detached($message, $sk) |
|
445 | + function crypto_sign_detached( $message, $sk ) |
|
446 | 446 | { |
447 | - return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
447 | + return ParagonIE_Sodium_Compat::crypto_sign_detached( $message, $sk ); |
|
448 | 448 | } |
449 | 449 | } |
450 | -if (!is_callable('\\Sodium\\crypto_sign_keypair')) { |
|
450 | +if ( ! is_callable( '\\Sodium\\crypto_sign_keypair' ) ) { |
|
451 | 451 | /** |
452 | 452 | * @return string |
453 | 453 | */ |
@@ -456,163 +456,163 @@ discard block |
||
456 | 456 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
457 | 457 | } |
458 | 458 | } |
459 | -if (!is_callable('\\Sodium\\crypto_sign_open')) { |
|
459 | +if ( ! is_callable( '\\Sodium\\crypto_sign_open' ) ) { |
|
460 | 460 | /** |
461 | 461 | * @param string $signedMessage |
462 | 462 | * @param string $pk |
463 | 463 | * @return string|bool |
464 | 464 | */ |
465 | - function crypto_sign_open($signedMessage, $pk) |
|
465 | + function crypto_sign_open( $signedMessage, $pk ) |
|
466 | 466 | { |
467 | 467 | try { |
468 | - return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
469 | - } catch (\Error $ex) { |
|
468 | + return ParagonIE_Sodium_Compat::crypto_sign_open( $signedMessage, $pk ); |
|
469 | + } catch ( \Error $ex ) { |
|
470 | 470 | return false; |
471 | - } catch (\Exception $ex) { |
|
471 | + } catch ( \Exception $ex ) { |
|
472 | 472 | return false; |
473 | 473 | } |
474 | 474 | } |
475 | 475 | } |
476 | -if (!is_callable('\\Sodium\\crypto_sign_publickey')) { |
|
476 | +if ( ! is_callable( '\\Sodium\\crypto_sign_publickey' ) ) { |
|
477 | 477 | /** |
478 | 478 | * @param string $keypair |
479 | 479 | * @return string |
480 | 480 | */ |
481 | - function crypto_sign_publickey($keypair) |
|
481 | + function crypto_sign_publickey( $keypair ) |
|
482 | 482 | { |
483 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
483 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey( $keypair ); |
|
484 | 484 | } |
485 | 485 | } |
486 | -if (!is_callable('\\Sodium\\crypto_sign_publickey_from_secretkey')) { |
|
486 | +if ( ! is_callable( '\\Sodium\\crypto_sign_publickey_from_secretkey' ) ) { |
|
487 | 487 | /** |
488 | 488 | * @param string $sk |
489 | 489 | * @return string |
490 | 490 | */ |
491 | - function crypto_sign_publickey_from_secretkey($sk) |
|
491 | + function crypto_sign_publickey_from_secretkey( $sk ) |
|
492 | 492 | { |
493 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
493 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey( $sk ); |
|
494 | 494 | } |
495 | 495 | } |
496 | -if (!is_callable('\\Sodium\\crypto_sign_secretkey')) { |
|
496 | +if ( ! is_callable( '\\Sodium\\crypto_sign_secretkey' ) ) { |
|
497 | 497 | /** |
498 | 498 | * @param string $keypair |
499 | 499 | * @return string |
500 | 500 | */ |
501 | - function crypto_sign_secretkey($keypair) |
|
501 | + function crypto_sign_secretkey( $keypair ) |
|
502 | 502 | { |
503 | - return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
503 | + return ParagonIE_Sodium_Compat::crypto_sign_secretkey( $keypair ); |
|
504 | 504 | } |
505 | 505 | } |
506 | -if (!is_callable('\\Sodium\\crypto_sign_seed_keypair')) { |
|
506 | +if ( ! is_callable( '\\Sodium\\crypto_sign_seed_keypair' ) ) { |
|
507 | 507 | /** |
508 | 508 | * @param string $seed |
509 | 509 | * @return string |
510 | 510 | */ |
511 | - function crypto_sign_seed_keypair($seed) |
|
511 | + function crypto_sign_seed_keypair( $seed ) |
|
512 | 512 | { |
513 | - return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
513 | + return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair( $seed ); |
|
514 | 514 | } |
515 | 515 | } |
516 | -if (!is_callable('\\Sodium\\crypto_sign_verify_detached')) { |
|
516 | +if ( ! is_callable( '\\Sodium\\crypto_sign_verify_detached' ) ) { |
|
517 | 517 | /** |
518 | 518 | * @param string $signature |
519 | 519 | * @param string $message |
520 | 520 | * @param string $pk |
521 | 521 | * @return bool |
522 | 522 | */ |
523 | - function crypto_sign_verify_detached($signature, $message, $pk) |
|
523 | + function crypto_sign_verify_detached( $signature, $message, $pk ) |
|
524 | 524 | { |
525 | - return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
525 | + return ParagonIE_Sodium_Compat::crypto_sign_verify_detached( $signature, $message, $pk ); |
|
526 | 526 | } |
527 | 527 | } |
528 | -if (!is_callable('\\Sodium\\crypto_sign_ed25519_sk_to_curve25519')) { |
|
528 | +if ( ! is_callable( '\\Sodium\\crypto_sign_ed25519_sk_to_curve25519' ) ) { |
|
529 | 529 | /** |
530 | 530 | * @param string $sk |
531 | 531 | * @return string |
532 | 532 | */ |
533 | - function crypto_sign_ed25519_sk_to_curve25519($sk) |
|
533 | + function crypto_sign_ed25519_sk_to_curve25519( $sk ) |
|
534 | 534 | { |
535 | - return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
|
535 | + return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519( $sk ); |
|
536 | 536 | } |
537 | 537 | } |
538 | -if (!is_callable('\\Sodium\\crypto_stream')) { |
|
538 | +if ( ! is_callable( '\\Sodium\\crypto_stream' ) ) { |
|
539 | 539 | /** |
540 | 540 | * @param int $len |
541 | 541 | * @param string $nonce |
542 | 542 | * @param string $key |
543 | 543 | * @return string |
544 | 544 | */ |
545 | - function crypto_stream($len, $nonce, $key) |
|
545 | + function crypto_stream( $len, $nonce, $key ) |
|
546 | 546 | { |
547 | - return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
547 | + return ParagonIE_Sodium_Compat::crypto_stream( $len, $nonce, $key ); |
|
548 | 548 | } |
549 | 549 | } |
550 | -if (!is_callable('\\Sodium\\crypto_stream_xor')) { |
|
550 | +if ( ! is_callable( '\\Sodium\\crypto_stream_xor' ) ) { |
|
551 | 551 | /** |
552 | 552 | * @param string $message |
553 | 553 | * @param string $nonce |
554 | 554 | * @param string $key |
555 | 555 | * @return string |
556 | 556 | */ |
557 | - function crypto_stream_xor($message, $nonce, $key) |
|
557 | + function crypto_stream_xor( $message, $nonce, $key ) |
|
558 | 558 | { |
559 | - return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
559 | + return ParagonIE_Sodium_Compat::crypto_stream_xor( $message, $nonce, $key ); |
|
560 | 560 | } |
561 | 561 | } |
562 | -if (!is_callable('\\Sodium\\hex2bin')) { |
|
562 | +if ( ! is_callable( '\\Sodium\\hex2bin' ) ) { |
|
563 | 563 | /** |
564 | 564 | * @param string $string |
565 | 565 | * @return string |
566 | 566 | */ |
567 | - function hex2bin($string) |
|
567 | + function hex2bin( $string ) |
|
568 | 568 | { |
569 | - return ParagonIE_Sodium_Compat::hex2bin($string); |
|
569 | + return ParagonIE_Sodium_Compat::hex2bin( $string ); |
|
570 | 570 | } |
571 | 571 | } |
572 | -if (!is_callable('\\Sodium\\memcmp')) { |
|
572 | +if ( ! is_callable( '\\Sodium\\memcmp' ) ) { |
|
573 | 573 | /** |
574 | 574 | * @param string $a |
575 | 575 | * @param string $b |
576 | 576 | * @return int |
577 | 577 | */ |
578 | - function memcmp($a, $b) |
|
578 | + function memcmp( $a, $b ) |
|
579 | 579 | { |
580 | - return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
580 | + return ParagonIE_Sodium_Compat::memcmp( $a, $b ); |
|
581 | 581 | } |
582 | 582 | } |
583 | -if (!is_callable('\\Sodium\\memzero')) { |
|
583 | +if ( ! is_callable( '\\Sodium\\memzero' ) ) { |
|
584 | 584 | /** |
585 | 585 | * @param string $str |
586 | 586 | * @return void |
587 | 587 | */ |
588 | - function memzero(&$str) |
|
588 | + function memzero( &$str ) |
|
589 | 589 | { |
590 | - ParagonIE_Sodium_Compat::memzero($str); |
|
590 | + ParagonIE_Sodium_Compat::memzero( $str ); |
|
591 | 591 | } |
592 | 592 | } |
593 | -if (!is_callable('\\Sodium\\randombytes_buf')) { |
|
593 | +if ( ! is_callable( '\\Sodium\\randombytes_buf' ) ) { |
|
594 | 594 | /** |
595 | 595 | * @param int $amount |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - function randombytes_buf($amount) |
|
598 | + function randombytes_buf( $amount ) |
|
599 | 599 | { |
600 | - return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
600 | + return ParagonIE_Sodium_Compat::randombytes_buf( $amount ); |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
604 | -if (!is_callable('\\Sodium\\randombytes_uniform')) { |
|
604 | +if ( ! is_callable( '\\Sodium\\randombytes_uniform' ) ) { |
|
605 | 605 | /** |
606 | 606 | * @param int $upperLimit |
607 | 607 | * @return int |
608 | 608 | */ |
609 | - function randombytes_uniform($upperLimit) |
|
609 | + function randombytes_uniform( $upperLimit ) |
|
610 | 610 | { |
611 | - return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
611 | + return ParagonIE_Sodium_Compat::randombytes_uniform( $upperLimit ); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | -if (!is_callable('\\Sodium\\randombytes_random16')) { |
|
615 | +if ( ! is_callable( '\\Sodium\\randombytes_random16' ) ) { |
|
616 | 616 | /** |
617 | 617 | * @return int |
618 | 618 | */ |
@@ -622,6 +622,6 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | -if (!defined('\\Sodium\\CRYPTO_AUTH_BYTES')) { |
|
626 | - require_once dirname(__FILE__) . '/constants.php'; |
|
625 | +if ( ! defined( '\\Sodium\\CRYPTO_AUTH_BYTES' ) ) { |
|
626 | + require_once dirname( __FILE__ ) . '/constants.php'; |
|
627 | 627 | } |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | * @param string $string |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - function bin2hex($string) |
|
19 | - { |
|
18 | + function bin2hex($string) { |
|
20 | 19 | return ParagonIE_Sodium_Compat::bin2hex($string); |
21 | 20 | } |
22 | 21 | } |
@@ -26,8 +25,7 @@ discard block |
||
26 | 25 | * @param string $b |
27 | 26 | * @return int |
28 | 27 | */ |
29 | - function compare($a, $b) |
|
30 | - { |
|
28 | + function compare($a, $b) { |
|
31 | 29 | return ParagonIE_Sodium_Compat::compare($a, $b); |
32 | 30 | } |
33 | 31 | } |
@@ -39,8 +37,7 @@ discard block |
||
39 | 37 | * @param string $key |
40 | 38 | * @return string|bool |
41 | 39 | */ |
42 | - function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
43 | - { |
|
40 | + function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) { |
|
44 | 41 | try { |
45 | 42 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
46 | 43 | } catch (Error $ex) { |
@@ -58,8 +55,7 @@ discard block |
||
58 | 55 | * @param string $key |
59 | 56 | * @return string |
60 | 57 | */ |
61 | - function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
62 | - { |
|
58 | + function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) { |
|
63 | 59 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
64 | 60 | } |
65 | 61 | } |
@@ -71,8 +67,7 @@ discard block |
||
71 | 67 | * @param string $key |
72 | 68 | * @return string|bool |
73 | 69 | */ |
74 | - function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
75 | - { |
|
70 | + function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) { |
|
76 | 71 | try { |
77 | 72 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
78 | 73 | } catch (Error $ex) { |
@@ -90,8 +85,7 @@ discard block |
||
90 | 85 | * @param string $key |
91 | 86 | * @return string |
92 | 87 | */ |
93 | - function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
94 | - { |
|
88 | + function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) { |
|
95 | 89 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
96 | 90 | } |
97 | 91 | } |
@@ -101,8 +95,7 @@ discard block |
||
101 | 95 | * @param string $key |
102 | 96 | * @return string |
103 | 97 | */ |
104 | - function crypto_auth($message, $key) |
|
105 | - { |
|
98 | + function crypto_auth($message, $key) { |
|
106 | 99 | return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
107 | 100 | } |
108 | 101 | } |
@@ -113,8 +106,7 @@ discard block |
||
113 | 106 | * @param string $key |
114 | 107 | * @return bool |
115 | 108 | */ |
116 | - function crypto_auth_verify($mac, $message, $key) |
|
117 | - { |
|
109 | + function crypto_auth_verify($mac, $message, $key) { |
|
118 | 110 | return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
119 | 111 | } |
120 | 112 | } |
@@ -125,8 +117,7 @@ discard block |
||
125 | 117 | * @param string $kp |
126 | 118 | * @return string |
127 | 119 | */ |
128 | - function crypto_box($message, $nonce, $kp) |
|
129 | - { |
|
120 | + function crypto_box($message, $nonce, $kp) { |
|
130 | 121 | return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
131 | 122 | } |
132 | 123 | } |
@@ -134,8 +125,7 @@ discard block |
||
134 | 125 | /** |
135 | 126 | * @return string |
136 | 127 | */ |
137 | - function crypto_box_keypair() |
|
138 | - { |
|
128 | + function crypto_box_keypair() { |
|
139 | 129 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
140 | 130 | } |
141 | 131 | } |
@@ -145,8 +135,7 @@ discard block |
||
145 | 135 | * @param string $pk |
146 | 136 | * @return string |
147 | 137 | */ |
148 | - function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
149 | - { |
|
138 | + function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) { |
|
150 | 139 | return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
151 | 140 | } |
152 | 141 | } |
@@ -157,8 +146,7 @@ discard block |
||
157 | 146 | * @param string $kp |
158 | 147 | * @return string|bool |
159 | 148 | */ |
160 | - function crypto_box_open($message, $nonce, $kp) |
|
161 | - { |
|
149 | + function crypto_box_open($message, $nonce, $kp) { |
|
162 | 150 | try { |
163 | 151 | return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
164 | 152 | } catch (Error $ex) { |
@@ -173,8 +161,7 @@ discard block |
||
173 | 161 | * @param string $keypair |
174 | 162 | * @return string |
175 | 163 | */ |
176 | - function crypto_box_publickey($keypair) |
|
177 | - { |
|
164 | + function crypto_box_publickey($keypair) { |
|
178 | 165 | return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
179 | 166 | } |
180 | 167 | } |
@@ -183,8 +170,7 @@ discard block |
||
183 | 170 | * @param string $sk |
184 | 171 | * @return string |
185 | 172 | */ |
186 | - function crypto_box_publickey_from_secretkey($sk) |
|
187 | - { |
|
173 | + function crypto_box_publickey_from_secretkey($sk) { |
|
188 | 174 | return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
189 | 175 | } |
190 | 176 | } |
@@ -194,8 +180,7 @@ discard block |
||
194 | 180 | * @param string $publicKey |
195 | 181 | * @return string |
196 | 182 | */ |
197 | - function crypto_box_seal($message, $publicKey) |
|
198 | - { |
|
183 | + function crypto_box_seal($message, $publicKey) { |
|
199 | 184 | return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
200 | 185 | } |
201 | 186 | } |
@@ -205,8 +190,7 @@ discard block |
||
205 | 190 | * @param string $kp |
206 | 191 | * @return string|bool |
207 | 192 | */ |
208 | - function crypto_box_seal_open($message, $kp) |
|
209 | - { |
|
193 | + function crypto_box_seal_open($message, $kp) { |
|
210 | 194 | try { |
211 | 195 | return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
212 | 196 | } catch (\Error $ex) { |
@@ -221,8 +205,7 @@ discard block |
||
221 | 205 | * @param string $keypair |
222 | 206 | * @return string |
223 | 207 | */ |
224 | - function crypto_box_secretkey($keypair) |
|
225 | - { |
|
208 | + function crypto_box_secretkey($keypair) { |
|
226 | 209 | return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
227 | 210 | } |
228 | 211 | } |
@@ -233,8 +216,7 @@ discard block |
||
233 | 216 | * @param int $outLen |
234 | 217 | * @return string |
235 | 218 | */ |
236 | - function crypto_generichash($message, $key = null, $outLen = 32) |
|
237 | - { |
|
219 | + function crypto_generichash($message, $key = null, $outLen = 32) { |
|
238 | 220 | return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
239 | 221 | } |
240 | 222 | } |
@@ -244,8 +226,7 @@ discard block |
||
244 | 226 | * @param int $outputLength |
245 | 227 | * @return string |
246 | 228 | */ |
247 | - function crypto_generichash_final(&$ctx, $outputLength = 32) |
|
248 | - { |
|
229 | + function crypto_generichash_final(&$ctx, $outputLength = 32) { |
|
249 | 230 | return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
250 | 231 | } |
251 | 232 | } |
@@ -255,8 +236,7 @@ discard block |
||
255 | 236 | * @param int $outLen |
256 | 237 | * @return string |
257 | 238 | */ |
258 | - function crypto_generichash_init($key = null, $outLen = 32) |
|
259 | - { |
|
239 | + function crypto_generichash_init($key = null, $outLen = 32) { |
|
260 | 240 | return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
261 | 241 | } |
262 | 242 | } |
@@ -266,8 +246,7 @@ discard block |
||
266 | 246 | * @param string $message |
267 | 247 | * @return void |
268 | 248 | */ |
269 | - function crypto_generichash_update(&$ctx, $message = '') |
|
270 | - { |
|
249 | + function crypto_generichash_update(&$ctx, $message = '') { |
|
271 | 250 | ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
272 | 251 | } |
273 | 252 | } |
@@ -279,8 +258,7 @@ discard block |
||
279 | 258 | * @param string $server_public |
280 | 259 | * @return string |
281 | 260 | */ |
282 | - function crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
283 | - { |
|
261 | + function crypto_kx($my_secret, $their_public, $client_public, $server_public) { |
|
284 | 262 | return ParagonIE_Sodium_Compat::crypto_kx( |
285 | 263 | $my_secret, |
286 | 264 | $their_public, |
@@ -298,8 +276,7 @@ discard block |
||
298 | 276 | * @param int $memlimit |
299 | 277 | * @return string |
300 | 278 | */ |
301 | - function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
302 | - { |
|
279 | + function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
303 | 280 | return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
304 | 281 | } |
305 | 282 | } |
@@ -310,8 +287,7 @@ discard block |
||
310 | 287 | * @param int $memlimit |
311 | 288 | * @return string |
312 | 289 | */ |
313 | - function crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
314 | - { |
|
290 | + function crypto_pwhash_str($passwd, $opslimit, $memlimit) { |
|
315 | 291 | return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
316 | 292 | } |
317 | 293 | } |
@@ -321,8 +297,7 @@ discard block |
||
321 | 297 | * @param string $hash |
322 | 298 | * @return bool |
323 | 299 | */ |
324 | - function crypto_pwhash_str_verify($passwd, $hash) |
|
325 | - { |
|
300 | + function crypto_pwhash_str_verify($passwd, $hash) { |
|
326 | 301 | return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
327 | 302 | } |
328 | 303 | } |
@@ -335,8 +310,7 @@ discard block |
||
335 | 310 | * @param int $memlimit |
336 | 311 | * @return string |
337 | 312 | */ |
338 | - function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
339 | - { |
|
313 | + function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) { |
|
340 | 314 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
341 | 315 | } |
342 | 316 | } |
@@ -347,8 +321,7 @@ discard block |
||
347 | 321 | * @param int $memlimit |
348 | 322 | * @return string |
349 | 323 | */ |
350 | - function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
351 | - { |
|
324 | + function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) { |
|
352 | 325 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
353 | 326 | } |
354 | 327 | } |
@@ -358,8 +331,7 @@ discard block |
||
358 | 331 | * @param string $hash |
359 | 332 | * @return bool |
360 | 333 | */ |
361 | - function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
362 | - { |
|
334 | + function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) { |
|
363 | 335 | return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
364 | 336 | } |
365 | 337 | } |
@@ -369,8 +341,7 @@ discard block |
||
369 | 341 | * @param string $p |
370 | 342 | * @return string |
371 | 343 | */ |
372 | - function crypto_scalarmult($n, $p) |
|
373 | - { |
|
344 | + function crypto_scalarmult($n, $p) { |
|
374 | 345 | return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
375 | 346 | } |
376 | 347 | } |
@@ -379,8 +350,7 @@ discard block |
||
379 | 350 | * @param string $n |
380 | 351 | * @return string |
381 | 352 | */ |
382 | - function crypto_scalarmult_base($n) |
|
383 | - { |
|
353 | + function crypto_scalarmult_base($n) { |
|
384 | 354 | return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
385 | 355 | } |
386 | 356 | } |
@@ -391,8 +361,7 @@ discard block |
||
391 | 361 | * @param string $key |
392 | 362 | * @return string |
393 | 363 | */ |
394 | - function crypto_secretbox($message, $nonce, $key) |
|
395 | - { |
|
364 | + function crypto_secretbox($message, $nonce, $key) { |
|
396 | 365 | return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
397 | 366 | } |
398 | 367 | } |
@@ -403,8 +372,7 @@ discard block |
||
403 | 372 | * @param string $key |
404 | 373 | * @return string|bool |
405 | 374 | */ |
406 | - function crypto_secretbox_open($message, $nonce, $key) |
|
407 | - { |
|
375 | + function crypto_secretbox_open($message, $nonce, $key) { |
|
408 | 376 | try { |
409 | 377 | return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
410 | 378 | } catch (Error $ex) { |
@@ -420,8 +388,7 @@ discard block |
||
420 | 388 | * @param string $key |
421 | 389 | * @return string |
422 | 390 | */ |
423 | - function crypto_shorthash($message, $key = '') |
|
424 | - { |
|
391 | + function crypto_shorthash($message, $key = '') { |
|
425 | 392 | return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
426 | 393 | } |
427 | 394 | } |
@@ -431,8 +398,7 @@ discard block |
||
431 | 398 | * @param string $sk |
432 | 399 | * @return string |
433 | 400 | */ |
434 | - function crypto_sign($message, $sk) |
|
435 | - { |
|
401 | + function crypto_sign($message, $sk) { |
|
436 | 402 | return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
437 | 403 | } |
438 | 404 | } |
@@ -442,8 +408,7 @@ discard block |
||
442 | 408 | * @param string $sk |
443 | 409 | * @return string |
444 | 410 | */ |
445 | - function crypto_sign_detached($message, $sk) |
|
446 | - { |
|
411 | + function crypto_sign_detached($message, $sk) { |
|
447 | 412 | return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
448 | 413 | } |
449 | 414 | } |
@@ -451,8 +416,7 @@ discard block |
||
451 | 416 | /** |
452 | 417 | * @return string |
453 | 418 | */ |
454 | - function crypto_sign_keypair() |
|
455 | - { |
|
419 | + function crypto_sign_keypair() { |
|
456 | 420 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
457 | 421 | } |
458 | 422 | } |
@@ -462,8 +426,7 @@ discard block |
||
462 | 426 | * @param string $pk |
463 | 427 | * @return string|bool |
464 | 428 | */ |
465 | - function crypto_sign_open($signedMessage, $pk) |
|
466 | - { |
|
429 | + function crypto_sign_open($signedMessage, $pk) { |
|
467 | 430 | try { |
468 | 431 | return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
469 | 432 | } catch (\Error $ex) { |
@@ -478,8 +441,7 @@ discard block |
||
478 | 441 | * @param string $keypair |
479 | 442 | * @return string |
480 | 443 | */ |
481 | - function crypto_sign_publickey($keypair) |
|
482 | - { |
|
444 | + function crypto_sign_publickey($keypair) { |
|
483 | 445 | return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
484 | 446 | } |
485 | 447 | } |
@@ -488,8 +450,7 @@ discard block |
||
488 | 450 | * @param string $sk |
489 | 451 | * @return string |
490 | 452 | */ |
491 | - function crypto_sign_publickey_from_secretkey($sk) |
|
492 | - { |
|
453 | + function crypto_sign_publickey_from_secretkey($sk) { |
|
493 | 454 | return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
494 | 455 | } |
495 | 456 | } |
@@ -498,8 +459,7 @@ discard block |
||
498 | 459 | * @param string $keypair |
499 | 460 | * @return string |
500 | 461 | */ |
501 | - function crypto_sign_secretkey($keypair) |
|
502 | - { |
|
462 | + function crypto_sign_secretkey($keypair) { |
|
503 | 463 | return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
504 | 464 | } |
505 | 465 | } |
@@ -508,8 +468,7 @@ discard block |
||
508 | 468 | * @param string $seed |
509 | 469 | * @return string |
510 | 470 | */ |
511 | - function crypto_sign_seed_keypair($seed) |
|
512 | - { |
|
471 | + function crypto_sign_seed_keypair($seed) { |
|
513 | 472 | return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
514 | 473 | } |
515 | 474 | } |
@@ -520,8 +479,7 @@ discard block |
||
520 | 479 | * @param string $pk |
521 | 480 | * @return bool |
522 | 481 | */ |
523 | - function crypto_sign_verify_detached($signature, $message, $pk) |
|
524 | - { |
|
482 | + function crypto_sign_verify_detached($signature, $message, $pk) { |
|
525 | 483 | return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
526 | 484 | } |
527 | 485 | } |
@@ -530,8 +488,7 @@ discard block |
||
530 | 488 | * @param string $sk |
531 | 489 | * @return string |
532 | 490 | */ |
533 | - function crypto_sign_ed25519_sk_to_curve25519($sk) |
|
534 | - { |
|
491 | + function crypto_sign_ed25519_sk_to_curve25519($sk) { |
|
535 | 492 | return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
536 | 493 | } |
537 | 494 | } |
@@ -542,8 +499,7 @@ discard block |
||
542 | 499 | * @param string $key |
543 | 500 | * @return string |
544 | 501 | */ |
545 | - function crypto_stream($len, $nonce, $key) |
|
546 | - { |
|
502 | + function crypto_stream($len, $nonce, $key) { |
|
547 | 503 | return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
548 | 504 | } |
549 | 505 | } |
@@ -554,8 +510,7 @@ discard block |
||
554 | 510 | * @param string $key |
555 | 511 | * @return string |
556 | 512 | */ |
557 | - function crypto_stream_xor($message, $nonce, $key) |
|
558 | - { |
|
513 | + function crypto_stream_xor($message, $nonce, $key) { |
|
559 | 514 | return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
560 | 515 | } |
561 | 516 | } |
@@ -564,8 +519,7 @@ discard block |
||
564 | 519 | * @param string $string |
565 | 520 | * @return string |
566 | 521 | */ |
567 | - function hex2bin($string) |
|
568 | - { |
|
522 | + function hex2bin($string) { |
|
569 | 523 | return ParagonIE_Sodium_Compat::hex2bin($string); |
570 | 524 | } |
571 | 525 | } |
@@ -575,8 +529,7 @@ discard block |
||
575 | 529 | * @param string $b |
576 | 530 | * @return int |
577 | 531 | */ |
578 | - function memcmp($a, $b) |
|
579 | - { |
|
532 | + function memcmp($a, $b) { |
|
580 | 533 | return ParagonIE_Sodium_Compat::memcmp($a, $b); |
581 | 534 | } |
582 | 535 | } |
@@ -585,8 +538,7 @@ discard block |
||
585 | 538 | * @param string $str |
586 | 539 | * @return void |
587 | 540 | */ |
588 | - function memzero(&$str) |
|
589 | - { |
|
541 | + function memzero(&$str) { |
|
590 | 542 | ParagonIE_Sodium_Compat::memzero($str); |
591 | 543 | } |
592 | 544 | } |
@@ -595,8 +547,7 @@ discard block |
||
595 | 547 | * @param int $amount |
596 | 548 | * @return string |
597 | 549 | */ |
598 | - function randombytes_buf($amount) |
|
599 | - { |
|
550 | + function randombytes_buf($amount) { |
|
600 | 551 | return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
601 | 552 | } |
602 | 553 | } |
@@ -606,8 +557,7 @@ discard block |
||
606 | 557 | * @param int $upperLimit |
607 | 558 | * @return int |
608 | 559 | */ |
609 | - function randombytes_uniform($upperLimit) |
|
610 | - { |
|
560 | + function randombytes_uniform($upperLimit) { |
|
611 | 561 | return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
612 | 562 | } |
613 | 563 | } |
@@ -616,8 +566,7 @@ discard block |
||
616 | 566 | /** |
617 | 567 | * @return int |
618 | 568 | */ |
619 | - function randombytes_random16() |
|
620 | - { |
|
569 | + function randombytes_random16() { |
|
621 | 570 | return ParagonIE_Sodium_Compat::randombytes_random16(); |
622 | 571 | } |
623 | 572 | } |