@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * SOFTWARE. |
27 | 27 | */ |
28 | 28 | |
29 | -if (!is_callable('RandomCompat_intval')) { |
|
29 | +if ( ! is_callable( 'RandomCompat_intval' ) ) { |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Cast to an integer if we can, safely. |
@@ -45,29 +45,29 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @throws TypeError |
47 | 47 | */ |
48 | - function RandomCompat_intval($number, $fail_open = false) |
|
48 | + function RandomCompat_intval( $number, $fail_open = false ) |
|
49 | 49 | { |
50 | - if (is_int($number) || is_float($number)) { |
|
50 | + if ( is_int( $number ) || is_float( $number ) ) { |
|
51 | 51 | $number += 0; |
52 | - } elseif (is_numeric($number)) { |
|
52 | + } elseif ( is_numeric( $number ) ) { |
|
53 | 53 | /** @psalm-suppress InvalidOperand */ |
54 | 54 | $number += 0; |
55 | 55 | } |
56 | 56 | /** @var int|float $number */ |
57 | 57 | |
58 | 58 | if ( |
59 | - is_float($number) |
|
59 | + is_float( $number ) |
|
60 | 60 | && |
61 | 61 | $number > ~PHP_INT_MAX |
62 | 62 | && |
63 | 63 | $number < PHP_INT_MAX |
64 | 64 | ) { |
65 | - $number = (int) $number; |
|
65 | + $number = (int)$number; |
|
66 | 66 | } |
67 | 67 | |
68 | - if (is_int($number)) { |
|
69 | - return (int) $number; |
|
70 | - } elseif (!$fail_open) { |
|
68 | + if ( is_int( $number ) ) { |
|
69 | + return (int)$number; |
|
70 | + } elseif ( ! $fail_open ) { |
|
71 | 71 | throw new TypeError( |
72 | 72 | 'Expected an integer.' |
73 | 73 | ); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * SOFTWARE. |
27 | 27 | */ |
28 | 28 | |
29 | -if (!is_callable('random_bytes')) { |
|
29 | +if ( ! is_callable( 'random_bytes' ) ) { |
|
30 | 30 | /** |
31 | 31 | * Powered by ext/mcrypt (and thankfully NOT libmcrypt) |
32 | 32 | * |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - function random_bytes($bytes) |
|
42 | + function random_bytes( $bytes ) |
|
43 | 43 | { |
44 | 44 | try { |
45 | 45 | /** @var int $bytes */ |
46 | - $bytes = RandomCompat_intval($bytes); |
|
47 | - } catch (TypeError $ex) { |
|
46 | + $bytes = RandomCompat_intval( $bytes ); |
|
47 | + } catch ( TypeError $ex ) { |
|
48 | 48 | throw new TypeError( |
49 | 49 | 'random_bytes(): $bytes must be an integer' |
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - if ($bytes < 1) { |
|
53 | + if ( $bytes < 1 ) { |
|
54 | 54 | throw new Error( |
55 | 55 | 'Length must be greater than 0' |
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** @var string|bool $buf */ |
60 | - $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); |
|
60 | + $buf = @mcrypt_create_iv( (int)$bytes, (int)MCRYPT_DEV_URANDOM ); |
|
61 | 61 | if ( |
62 | - is_string($buf) |
|
62 | + is_string( $buf ) |
|
63 | 63 | && |
64 | - RandomCompat_strlen($buf) === $bytes |
|
64 | + RandomCompat_strlen( $buf ) === $bytes |
|
65 | 65 | ) { |
66 | 66 | /** |
67 | 67 | * Return our random entropy buffer here: |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * SOFTWARE. |
27 | 27 | */ |
28 | 28 | |
29 | -if (!is_callable('random_bytes')) { |
|
29 | +if ( ! is_callable( 'random_bytes' ) ) { |
|
30 | 30 | /** |
31 | 31 | * If the libsodium PHP extension is loaded, we'll use it above any other |
32 | 32 | * solution. |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return string |
42 | 42 | */ |
43 | - function random_bytes($bytes) |
|
43 | + function random_bytes( $bytes ) |
|
44 | 44 | { |
45 | 45 | try { |
46 | 46 | /** @var int $bytes */ |
47 | - $bytes = RandomCompat_intval($bytes); |
|
48 | - } catch (TypeError $ex) { |
|
47 | + $bytes = RandomCompat_intval( $bytes ); |
|
48 | + } catch ( TypeError $ex ) { |
|
49 | 49 | throw new TypeError( |
50 | 50 | 'random_bytes(): $bytes must be an integer' |
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | - if ($bytes < 1) { |
|
54 | + if ( $bytes < 1 ) { |
|
55 | 55 | throw new Error( |
56 | 56 | 'Length must be greater than 0' |
57 | 57 | ); |
@@ -62,21 +62,21 @@ discard block |
||
62 | 62 | * generated in one invocation. |
63 | 63 | */ |
64 | 64 | /** @var string|bool $buf */ |
65 | - if ($bytes > 2147483647) { |
|
65 | + if ( $bytes > 2147483647 ) { |
|
66 | 66 | $buf = ''; |
67 | - for ($i = 0; $i < $bytes; $i += 1073741824) { |
|
68 | - $n = ($bytes - $i) > 1073741824 |
|
67 | + for ( $i = 0; $i < $bytes; $i += 1073741824 ) { |
|
68 | + $n = ( $bytes - $i ) > 1073741824 |
|
69 | 69 | ? 1073741824 |
70 | 70 | : $bytes - $i; |
71 | - $buf .= \Sodium\randombytes_buf($n); |
|
71 | + $buf .= \Sodium\randombytes_buf( $n ); |
|
72 | 72 | } |
73 | 73 | } else { |
74 | 74 | /** @var string|bool $buf */ |
75 | - $buf = \Sodium\randombytes_buf($bytes); |
|
75 | + $buf = \Sodium\randombytes_buf( $bytes ); |
|
76 | 76 | } |
77 | 77 | |
78 | - if (is_string($buf)) { |
|
79 | - if (RandomCompat_strlen($buf) === $bytes) { |
|
78 | + if ( is_string( $buf ) ) { |
|
79 | + if ( RandomCompat_strlen( $buf ) === $bytes ) { |
|
80 | 80 | return $buf; |
81 | 81 | } |
82 | 82 | } |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | * SOFTWARE. |
30 | 30 | */ |
31 | 31 | |
32 | -if (!defined('PHP_VERSION_ID')) { |
|
32 | +if ( ! defined( 'PHP_VERSION_ID' ) ) { |
|
33 | 33 | // This constant was introduced in PHP 5.2.7 |
34 | - $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); |
|
34 | + $RandomCompatversion = array_map( 'intval', explode( '.', PHP_VERSION ) ); |
|
35 | 35 | define( |
36 | 36 | 'PHP_VERSION_ID', |
37 | - $RandomCompatversion[0] * 10000 |
|
38 | - + $RandomCompatversion[1] * 100 |
|
39 | - + $RandomCompatversion[2] |
|
37 | + $RandomCompatversion[ 0 ] * 10000 |
|
38 | + + $RandomCompatversion[ 1 ] * 100 |
|
39 | + + $RandomCompatversion[ 2 ] |
|
40 | 40 | ); |
41 | 41 | $RandomCompatversion = null; |
42 | 42 | } |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * PHP 7.0.0 and newer have these functions natively. |
46 | 46 | */ |
47 | -if (PHP_VERSION_ID >= 70000) { |
|
47 | +if ( PHP_VERSION_ID >= 70000 ) { |
|
48 | 48 | return; |
49 | 49 | } |
50 | 50 | |
51 | -if (!defined('RANDOM_COMPAT_READ_BUFFER')) { |
|
52 | - define('RANDOM_COMPAT_READ_BUFFER', 8); |
|
51 | +if ( ! defined( 'RANDOM_COMPAT_READ_BUFFER' ) ) { |
|
52 | + define( 'RANDOM_COMPAT_READ_BUFFER', 8 ); |
|
53 | 53 | } |
54 | 54 | |
55 | -$RandomCompatDIR = dirname(__FILE__); |
|
55 | +$RandomCompatDIR = dirname( __FILE__ ); |
|
56 | 56 | |
57 | -require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'byte_safe_strings.php'; |
|
58 | -require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'cast_to_int.php'; |
|
59 | -require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'error_polyfill.php'; |
|
57 | +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php'; |
|
58 | +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php'; |
|
59 | +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php'; |
|
60 | 60 | |
61 | -if (!is_callable('random_bytes')) { |
|
61 | +if ( ! is_callable( 'random_bytes' ) ) { |
|
62 | 62 | /** |
63 | 63 | * PHP 5.2.0 - 5.6.x way to implement random_bytes() |
64 | 64 | * |
@@ -73,42 +73,42 @@ discard block |
||
73 | 73 | * |
74 | 74 | * See RATIONALE.md for our reasoning behind this particular order |
75 | 75 | */ |
76 | - if (extension_loaded('libsodium')) { |
|
76 | + if ( extension_loaded( 'libsodium' ) ) { |
|
77 | 77 | // See random_bytes_libsodium.php |
78 | - if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { |
|
79 | - require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_libsodium.php'; |
|
80 | - } elseif (method_exists('Sodium', 'randombytes_buf')) { |
|
81 | - require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_libsodium_legacy.php'; |
|
78 | + if ( PHP_VERSION_ID >= 50300 && is_callable( '\\Sodium\\randombytes_buf' ) ) { |
|
79 | + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php'; |
|
80 | + } elseif ( method_exists( 'Sodium', 'randombytes_buf' ) ) { |
|
81 | + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php'; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Reading directly from /dev/urandom: |
87 | 87 | */ |
88 | - if (DIRECTORY_SEPARATOR === '/') { |
|
88 | + if ( DIRECTORY_SEPARATOR === '/' ) { |
|
89 | 89 | // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast |
90 | 90 | // way to exclude Windows. |
91 | 91 | $RandomCompatUrandom = true; |
92 | - $RandomCompat_basedir = ini_get('open_basedir'); |
|
92 | + $RandomCompat_basedir = ini_get( 'open_basedir' ); |
|
93 | 93 | |
94 | - if (!empty($RandomCompat_basedir)) { |
|
94 | + if ( ! empty( $RandomCompat_basedir ) ) { |
|
95 | 95 | $RandomCompat_open_basedir = explode( |
96 | 96 | PATH_SEPARATOR, |
97 | - strtolower($RandomCompat_basedir) |
|
97 | + strtolower( $RandomCompat_basedir ) |
|
98 | 98 | ); |
99 | - $RandomCompatUrandom = (array() !== array_intersect( |
|
100 | - array('/dev', '/dev/', '/dev/urandom'), |
|
99 | + $RandomCompatUrandom = ( array() !== array_intersect( |
|
100 | + array( '/dev', '/dev/', '/dev/urandom' ), |
|
101 | 101 | $RandomCompat_open_basedir |
102 | - )); |
|
102 | + ) ); |
|
103 | 103 | $RandomCompat_open_basedir = null; |
104 | 104 | } |
105 | 105 | |
106 | 106 | if ( |
107 | - !is_callable('random_bytes') |
|
107 | + ! is_callable( 'random_bytes' ) |
|
108 | 108 | && |
109 | 109 | $RandomCompatUrandom |
110 | 110 | && |
111 | - @is_readable('/dev/urandom') |
|
111 | + @is_readable( '/dev/urandom' ) |
|
112 | 112 | ) { |
113 | 113 | // Error suppression on is_readable() in case of an open_basedir |
114 | 114 | // or safe_mode failure. All we care about is whether or not we |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // place, that is not helpful to us here. |
118 | 118 | |
119 | 119 | // See random_bytes_dev_urandom.php |
120 | - require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_dev_urandom.php'; |
|
120 | + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php'; |
|
121 | 121 | } |
122 | 122 | // Unset variables after use |
123 | 123 | $RandomCompat_basedir = null; |
@@ -144,22 +144,22 @@ discard block |
||
144 | 144 | * we get insufficient entropy errors. |
145 | 145 | */ |
146 | 146 | if ( |
147 | - !is_callable('random_bytes') |
|
147 | + ! is_callable( 'random_bytes' ) |
|
148 | 148 | && |
149 | 149 | // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be. |
150 | - (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307) |
|
150 | + ( DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307 ) |
|
151 | 151 | && |
152 | 152 | // Prevent this code from hanging indefinitely on non-Windows; |
153 | 153 | // see https://bugs.php.net/bug.php?id=69833 |
154 | 154 | ( |
155 | 155 | DIRECTORY_SEPARATOR !== '/' || |
156 | - (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613) |
|
156 | + ( PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613 ) |
|
157 | 157 | ) |
158 | 158 | && |
159 | - extension_loaded('mcrypt') |
|
159 | + extension_loaded( 'mcrypt' ) |
|
160 | 160 | ) { |
161 | 161 | // See random_bytes_mcrypt.php |
162 | - require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_mcrypt.php'; |
|
162 | + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php'; |
|
163 | 163 | } |
164 | 164 | $RandomCompatUrandom = null; |
165 | 165 | |
@@ -168,26 +168,26 @@ discard block |
||
168 | 168 | * isn't loaded. |
169 | 169 | */ |
170 | 170 | if ( |
171 | - !is_callable('random_bytes') |
|
171 | + ! is_callable( 'random_bytes' ) |
|
172 | 172 | && |
173 | - extension_loaded('com_dotnet') |
|
173 | + extension_loaded( 'com_dotnet' ) |
|
174 | 174 | && |
175 | - class_exists('COM') |
|
175 | + class_exists( 'COM' ) |
|
176 | 176 | ) { |
177 | 177 | $RandomCompat_disabled_classes = preg_split( |
178 | 178 | '#\s*,\s*#', |
179 | - strtolower(ini_get('disable_classes')) |
|
179 | + strtolower( ini_get( 'disable_classes' ) ) |
|
180 | 180 | ); |
181 | 181 | |
182 | - if (!in_array('com', $RandomCompat_disabled_classes)) { |
|
182 | + if ( ! in_array( 'com', $RandomCompat_disabled_classes ) ) { |
|
183 | 183 | try { |
184 | - $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); |
|
184 | + $RandomCompatCOMtest = new COM( 'CAPICOM.Utilities.1' ); |
|
185 | 185 | /** @psalm-suppress TypeDoesNotContainType */ |
186 | - if (method_exists($RandomCompatCOMtest, 'GetRandom')) { |
|
186 | + if ( method_exists( $RandomCompatCOMtest, 'GetRandom' ) ) { |
|
187 | 187 | // See random_bytes_com_dotnet.php |
188 | - require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_com_dotnet.php'; |
|
188 | + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php'; |
|
189 | 189 | } |
190 | - } catch (com_exception $e) { |
|
190 | + } catch ( com_exception $e ) { |
|
191 | 191 | // Don't try to use it. |
192 | 192 | } |
193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | /** |
199 | 199 | * throw new Exception |
200 | 200 | */ |
201 | - if (!is_callable('random_bytes')) { |
|
201 | + if ( ! is_callable( 'random_bytes' ) ) { |
|
202 | 202 | /** |
203 | 203 | * We don't have any more options, so let's throw an exception right now |
204 | 204 | * and hope the developer won't let it fail silently. |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | * @throws Exception |
209 | 209 | * @return string |
210 | 210 | */ |
211 | - function random_bytes($length) |
|
211 | + function random_bytes( $length ) |
|
212 | 212 | { |
213 | - unset($length); // Suppress "variable not used" warnings. |
|
213 | + unset( $length ); // Suppress "variable not used" warnings. |
|
214 | 214 | throw new Exception( |
215 | 215 | 'There is no suitable CSPRNG installed on your system' |
216 | 216 | ); |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | -if (!is_callable('random_int')) { |
|
223 | - require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_int.php'; |
|
222 | +if ( ! is_callable( 'random_int' ) ) { |
|
223 | + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php'; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | $RandomCompatDIR = null; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * SOFTWARE. |
27 | 27 | */ |
28 | 28 | |
29 | -if (!class_exists('Error', false)) { |
|
29 | +if ( ! class_exists( 'Error', false ) ) { |
|
30 | 30 | // We can't really avoid making this extend Exception in PHP 5. |
31 | 31 | class Error extends Exception |
32 | 32 | { |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | -if (!class_exists('TypeError', false)) { |
|
38 | - if (is_subclass_of('Error', 'Exception')) { |
|
37 | +if ( ! class_exists( 'TypeError', false ) ) { |
|
38 | + if ( is_subclass_of( 'Error', 'Exception' ) ) { |
|
39 | 39 | class TypeError extends Error |
40 | 40 | { |
41 | 41 |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * SOFTWARE. |
27 | 27 | */ |
28 | 28 | |
29 | -if (!is_callable('RandomCompat_strlen')) { |
|
29 | +if ( ! is_callable( 'RandomCompat_strlen' ) ) { |
|
30 | 30 | if ( |
31 | - defined('MB_OVERLOAD_STRING') |
|
31 | + defined( 'MB_OVERLOAD_STRING' ) |
|
32 | 32 | && |
33 | - ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING |
|
33 | + ( (int)ini_get( 'mbstring.func_overload' ) ) & MB_OVERLOAD_STRING |
|
34 | 34 | ) { |
35 | 35 | /** |
36 | 36 | * strlen() implementation that isn't brittle to mbstring.func_overload |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return int |
46 | 46 | */ |
47 | - function RandomCompat_strlen($binary_string) |
|
47 | + function RandomCompat_strlen( $binary_string ) |
|
48 | 48 | { |
49 | - if (!is_string($binary_string)) { |
|
49 | + if ( ! is_string( $binary_string ) ) { |
|
50 | 50 | throw new TypeError( |
51 | 51 | 'RandomCompat_strlen() expects a string' |
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | - return (int) mb_strlen($binary_string, '8bit'); |
|
55 | + return (int)mb_strlen( $binary_string, '8bit' ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } else { |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return int |
69 | 69 | */ |
70 | - function RandomCompat_strlen($binary_string) |
|
70 | + function RandomCompat_strlen( $binary_string ) |
|
71 | 71 | { |
72 | - if (!is_string($binary_string)) { |
|
72 | + if ( ! is_string( $binary_string ) ) { |
|
73 | 73 | throw new TypeError( |
74 | 74 | 'RandomCompat_strlen() expects a string' |
75 | 75 | ); |
76 | 76 | } |
77 | - return (int) strlen($binary_string); |
|
77 | + return (int)strlen( $binary_string ); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | -if (!is_callable('RandomCompat_substr')) { |
|
82 | +if ( ! is_callable( 'RandomCompat_substr' ) ) { |
|
83 | 83 | |
84 | 84 | if ( |
85 | - defined('MB_OVERLOAD_STRING') |
|
85 | + defined( 'MB_OVERLOAD_STRING' ) |
|
86 | 86 | && |
87 | - ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING |
|
87 | + ( (int)ini_get( 'mbstring.func_overload' ) ) & MB_OVERLOAD_STRING |
|
88 | 88 | ) { |
89 | 89 | /** |
90 | 90 | * substr() implementation that isn't brittle to mbstring.func_overload |
@@ -100,45 +100,45 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string |
102 | 102 | */ |
103 | - function RandomCompat_substr($binary_string, $start, $length = null) |
|
103 | + function RandomCompat_substr( $binary_string, $start, $length = null ) |
|
104 | 104 | { |
105 | - if (!is_string($binary_string)) { |
|
105 | + if ( ! is_string( $binary_string ) ) { |
|
106 | 106 | throw new TypeError( |
107 | 107 | 'RandomCompat_substr(): First argument should be a string' |
108 | 108 | ); |
109 | 109 | } |
110 | 110 | |
111 | - if (!is_int($start)) { |
|
111 | + if ( ! is_int( $start ) ) { |
|
112 | 112 | throw new TypeError( |
113 | 113 | 'RandomCompat_substr(): Second argument should be an integer' |
114 | 114 | ); |
115 | 115 | } |
116 | 116 | |
117 | - if ($length === null) { |
|
117 | + if ( $length === null ) { |
|
118 | 118 | /** |
119 | 119 | * mb_substr($str, 0, NULL, '8bit') returns an empty string on |
120 | 120 | * PHP 5.3, so we have to find the length ourselves. |
121 | 121 | */ |
122 | 122 | /** @var int $length */ |
123 | - $length = RandomCompat_strlen($binary_string) - $start; |
|
124 | - } elseif (!is_int($length)) { |
|
123 | + $length = RandomCompat_strlen( $binary_string ) - $start; |
|
124 | + } elseif ( ! is_int( $length ) ) { |
|
125 | 125 | throw new TypeError( |
126 | 126 | 'RandomCompat_substr(): Third argument should be an integer, or omitted' |
127 | 127 | ); |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Consistency with PHP's behavior |
131 | - if ($start === RandomCompat_strlen($binary_string) && $length === 0) { |
|
131 | + if ( $start === RandomCompat_strlen( $binary_string ) && $length === 0 ) { |
|
132 | 132 | return ''; |
133 | 133 | } |
134 | - if ($start > RandomCompat_strlen($binary_string)) { |
|
134 | + if ( $start > RandomCompat_strlen( $binary_string ) ) { |
|
135 | 135 | return ''; |
136 | 136 | } |
137 | 137 | |
138 | - return (string) mb_substr( |
|
139 | - (string) $binary_string, |
|
140 | - (int) $start, |
|
141 | - (int) $length, |
|
138 | + return (string)mb_substr( |
|
139 | + (string)$binary_string, |
|
140 | + (int)$start, |
|
141 | + (int)$length, |
|
142 | 142 | '8bit' |
143 | 143 | ); |
144 | 144 | } |
@@ -158,37 +158,37 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - function RandomCompat_substr($binary_string, $start, $length = null) |
|
161 | + function RandomCompat_substr( $binary_string, $start, $length = null ) |
|
162 | 162 | { |
163 | - if (!is_string($binary_string)) { |
|
163 | + if ( ! is_string( $binary_string ) ) { |
|
164 | 164 | throw new TypeError( |
165 | 165 | 'RandomCompat_substr(): First argument should be a string' |
166 | 166 | ); |
167 | 167 | } |
168 | 168 | |
169 | - if (!is_int($start)) { |
|
169 | + if ( ! is_int( $start ) ) { |
|
170 | 170 | throw new TypeError( |
171 | 171 | 'RandomCompat_substr(): Second argument should be an integer' |
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - if ($length !== null) { |
|
176 | - if (!is_int($length)) { |
|
175 | + if ( $length !== null ) { |
|
176 | + if ( ! is_int( $length ) ) { |
|
177 | 177 | throw new TypeError( |
178 | 178 | 'RandomCompat_substr(): Third argument should be an integer, or omitted' |
179 | 179 | ); |
180 | 180 | } |
181 | 181 | |
182 | - return (string) substr( |
|
183 | - (string )$binary_string, |
|
184 | - (int) $start, |
|
185 | - (int) $length |
|
182 | + return (string)substr( |
|
183 | + (string)$binary_string, |
|
184 | + (int)$start, |
|
185 | + (int)$length |
|
186 | 186 | ); |
187 | 187 | } |
188 | 188 | |
189 | - return (string) substr( |
|
190 | - (string) $binary_string, |
|
191 | - (int) $start |
|
189 | + return (string)substr( |
|
190 | + (string)$binary_string, |
|
191 | + (int)$start |
|
192 | 192 | ); |
193 | 193 | } |
194 | 194 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * SOFTWARE. |
27 | 27 | */ |
28 | 28 | |
29 | -if (!is_callable('random_bytes')) { |
|
29 | +if ( ! is_callable( 'random_bytes' ) ) { |
|
30 | 30 | /** |
31 | 31 | * Windows with PHP < 5.3.0 will not have the function |
32 | 32 | * openssl_random_pseudo_bytes() available, so let's use |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - function random_bytes($bytes) |
|
41 | + function random_bytes( $bytes ) |
|
42 | 42 | { |
43 | 43 | try { |
44 | 44 | /** @var int $bytes */ |
45 | - $bytes = RandomCompat_intval($bytes); |
|
46 | - } catch (TypeError $ex) { |
|
45 | + $bytes = RandomCompat_intval( $bytes ); |
|
46 | + } catch ( TypeError $ex ) { |
|
47 | 47 | throw new TypeError( |
48 | 48 | 'random_bytes(): $bytes must be an integer' |
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - if ($bytes < 1) { |
|
52 | + if ( $bytes < 1 ) { |
|
53 | 53 | throw new Error( |
54 | 54 | 'Length must be greater than 0' |
55 | 55 | ); |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | |
58 | 58 | /** @var string $buf */ |
59 | 59 | $buf = ''; |
60 | - if (!class_exists('COM')) { |
|
60 | + if ( ! class_exists( 'COM' ) ) { |
|
61 | 61 | throw new Error( |
62 | 62 | 'COM does not exist' |
63 | 63 | ); |
64 | 64 | } |
65 | 65 | /** @var COM $util */ |
66 | - $util = new COM('CAPICOM.Utilities.1'); |
|
66 | + $util = new COM( 'CAPICOM.Utilities.1' ); |
|
67 | 67 | $execCount = 0; |
68 | 68 | |
69 | 69 | /** |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * get N bytes of random data, then CAPICOM has failed us. |
72 | 72 | */ |
73 | 73 | do { |
74 | - $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); |
|
75 | - if (RandomCompat_strlen($buf) >= $bytes) { |
|
74 | + $buf .= base64_decode( (string)$util->GetRandom( $bytes, 0 ) ); |
|
75 | + if ( RandomCompat_strlen( $buf ) >= $bytes ) { |
|
76 | 76 | /** |
77 | 77 | * Return our random entropy buffer here: |
78 | 78 | */ |
79 | - return (string) RandomCompat_substr($buf, 0, $bytes); |
|
79 | + return (string)RandomCompat_substr( $buf, 0, $bytes ); |
|
80 | 80 | } |
81 | 81 | ++$execCount; |
82 | - } while ($execCount < $bytes); |
|
82 | + } while ( $execCount < $bytes ); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * If we reach here, PHP has failed us. |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Sodium; |
3 | 3 | |
4 | -require_once dirname(dirname(__FILE__)) . '/autoload.php'; |
|
4 | +require_once dirname( dirname( __FILE__ ) ) . '/autoload.php'; |
|
5 | 5 | |
6 | 6 | use ParagonIE_Sodium_Compat; |
7 | 7 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * Thus, the functions just proxy to the appropriate ParagonIE_Sodium_Compat |
13 | 13 | * method. |
14 | 14 | */ |
15 | -if (!is_callable('\\Sodium\\bin2hex')) { |
|
15 | +if ( ! is_callable( '\\Sodium\\bin2hex' ) ) { |
|
16 | 16 | /** |
17 | 17 | * @see ParagonIE_Sodium_Compat::bin2hex() |
18 | 18 | * @param string $string |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | * @throws \SodiumException |
21 | 21 | * @throws \TypeError |
22 | 22 | */ |
23 | - function bin2hex($string) |
|
23 | + function bin2hex( $string ) |
|
24 | 24 | { |
25 | - return ParagonIE_Sodium_Compat::bin2hex($string); |
|
25 | + return ParagonIE_Sodium_Compat::bin2hex( $string ); |
|
26 | 26 | } |
27 | 27 | } |
28 | -if (!is_callable('\\Sodium\\compare')) { |
|
28 | +if ( ! is_callable( '\\Sodium\\compare' ) ) { |
|
29 | 29 | /** |
30 | 30 | * @see ParagonIE_Sodium_Compat::compare() |
31 | 31 | * @param string $a |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | * @throws \SodiumException |
35 | 35 | * @throws \TypeError |
36 | 36 | */ |
37 | - function compare($a, $b) |
|
37 | + function compare( $a, $b ) |
|
38 | 38 | { |
39 | - return ParagonIE_Sodium_Compat::compare($a, $b); |
|
39 | + return ParagonIE_Sodium_Compat::compare( $a, $b ); |
|
40 | 40 | } |
41 | 41 | } |
42 | -if (!is_callable('\\Sodium\\crypto_aead_aes256gcm_decrypt')) { |
|
42 | +if ( ! is_callable( '\\Sodium\\crypto_aead_aes256gcm_decrypt' ) ) { |
|
43 | 43 | /** |
44 | 44 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt() |
45 | 45 | * @param string $message |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | * @param string $key |
49 | 49 | * @return string|bool |
50 | 50 | */ |
51 | - function crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) |
|
51 | + function crypto_aead_aes256gcm_decrypt( $message, $assocData, $nonce, $key ) |
|
52 | 52 | { |
53 | 53 | try { |
54 | - return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key); |
|
55 | - } catch (\TypeError $ex) { |
|
54 | + return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt( $message, $assocData, $nonce, $key ); |
|
55 | + } catch ( \TypeError $ex ) { |
|
56 | 56 | return false; |
57 | - } catch (\SodiumException $ex) { |
|
57 | + } catch ( \SodiumException $ex ) { |
|
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
62 | -if (!is_callable('\\Sodium\\crypto_aead_aes256gcm_encrypt')) { |
|
62 | +if ( ! is_callable( '\\Sodium\\crypto_aead_aes256gcm_encrypt' ) ) { |
|
63 | 63 | /** |
64 | 64 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt() |
65 | 65 | * @param string $message |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | * @throws \SodiumException |
71 | 71 | * @throws \TypeError |
72 | 72 | */ |
73 | - function crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) |
|
73 | + function crypto_aead_aes256gcm_encrypt( $message, $assocData, $nonce, $key ) |
|
74 | 74 | { |
75 | - return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key); |
|
75 | + return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt( $message, $assocData, $nonce, $key ); |
|
76 | 76 | } |
77 | 77 | } |
78 | -if (!is_callable('\\Sodium\\crypto_aead_aes256gcm_is_available')) { |
|
78 | +if ( ! is_callable( '\\Sodium\\crypto_aead_aes256gcm_is_available' ) ) { |
|
79 | 79 | /** |
80 | 80 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available() |
81 | 81 | * @return bool |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available(); |
86 | 86 | } |
87 | 87 | } |
88 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_decrypt')) { |
|
88 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_decrypt' ) ) { |
|
89 | 89 | /** |
90 | 90 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt() |
91 | 91 | * @param string $message |
@@ -94,18 +94,18 @@ discard block |
||
94 | 94 | * @param string $key |
95 | 95 | * @return string|bool |
96 | 96 | */ |
97 | - function crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
97 | + function crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ) |
|
98 | 98 | { |
99 | 99 | try { |
100 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
101 | - } catch (\TypeError $ex) { |
|
100 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ); |
|
101 | + } catch ( \TypeError $ex ) { |
|
102 | 102 | return false; |
103 | - } catch (\SodiumException $ex) { |
|
103 | + } catch ( \SodiumException $ex ) { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_encrypt')) { |
|
108 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_encrypt' ) ) { |
|
109 | 109 | /** |
110 | 110 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt() |
111 | 111 | * @param string $message |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * @throws \SodiumException |
117 | 117 | * @throws \TypeError |
118 | 118 | */ |
119 | - function crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
119 | + function crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ) |
|
120 | 120 | { |
121 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
121 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ); |
|
122 | 122 | } |
123 | 123 | } |
124 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_decrypt')) { |
|
124 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_ietf_decrypt' ) ) { |
|
125 | 125 | /** |
126 | 126 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt() |
127 | 127 | * @param string $message |
@@ -130,18 +130,18 @@ discard block |
||
130 | 130 | * @param string $key |
131 | 131 | * @return string|bool |
132 | 132 | */ |
133 | - function crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
133 | + function crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ) |
|
134 | 134 | { |
135 | 135 | try { |
136 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
137 | - } catch (\TypeError $ex) { |
|
136 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ); |
|
137 | + } catch ( \TypeError $ex ) { |
|
138 | 138 | return false; |
139 | - } catch (\SodiumException $ex) { |
|
139 | + } catch ( \SodiumException $ex ) { |
|
140 | 140 | return false; |
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
144 | -if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_encrypt')) { |
|
144 | +if ( ! is_callable( '\\Sodium\\crypto_aead_chacha20poly1305_ietf_encrypt' ) ) { |
|
145 | 145 | /** |
146 | 146 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt() |
147 | 147 | * @param string $message |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | * @throws \SodiumException |
153 | 153 | * @throws \TypeError |
154 | 154 | */ |
155 | - function crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
155 | + function crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ) |
|
156 | 156 | { |
157 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
157 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ); |
|
158 | 158 | } |
159 | 159 | } |
160 | -if (!is_callable('\\Sodium\\crypto_auth')) { |
|
160 | +if ( ! is_callable( '\\Sodium\\crypto_auth' ) ) { |
|
161 | 161 | /** |
162 | 162 | * @see ParagonIE_Sodium_Compat::crypto_auth() |
163 | 163 | * @param string $message |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * @throws \SodiumException |
167 | 167 | * @throws \TypeError |
168 | 168 | */ |
169 | - function crypto_auth($message, $key) |
|
169 | + function crypto_auth( $message, $key ) |
|
170 | 170 | { |
171 | - return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
171 | + return ParagonIE_Sodium_Compat::crypto_auth( $message, $key ); |
|
172 | 172 | } |
173 | 173 | } |
174 | -if (!is_callable('\\Sodium\\crypto_auth_verify')) { |
|
174 | +if ( ! is_callable( '\\Sodium\\crypto_auth_verify' ) ) { |
|
175 | 175 | /** |
176 | 176 | * @see ParagonIE_Sodium_Compat::crypto_auth_verify() |
177 | 177 | * @param string $mac |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | * @throws \SodiumException |
182 | 182 | * @throws \TypeError |
183 | 183 | */ |
184 | - function crypto_auth_verify($mac, $message, $key) |
|
184 | + function crypto_auth_verify( $mac, $message, $key ) |
|
185 | 185 | { |
186 | - return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
186 | + return ParagonIE_Sodium_Compat::crypto_auth_verify( $mac, $message, $key ); |
|
187 | 187 | } |
188 | 188 | } |
189 | -if (!is_callable('\\Sodium\\crypto_box')) { |
|
189 | +if ( ! is_callable( '\\Sodium\\crypto_box' ) ) { |
|
190 | 190 | /** |
191 | 191 | * @see ParagonIE_Sodium_Compat::crypto_box() |
192 | 192 | * @param string $message |
@@ -196,12 +196,12 @@ discard block |
||
196 | 196 | * @throws \SodiumException |
197 | 197 | * @throws \TypeError |
198 | 198 | */ |
199 | - function crypto_box($message, $nonce, $kp) |
|
199 | + function crypto_box( $message, $nonce, $kp ) |
|
200 | 200 | { |
201 | - return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
201 | + return ParagonIE_Sodium_Compat::crypto_box( $message, $nonce, $kp ); |
|
202 | 202 | } |
203 | 203 | } |
204 | -if (!is_callable('\\Sodium\\crypto_box_keypair')) { |
|
204 | +if ( ! is_callable( '\\Sodium\\crypto_box_keypair' ) ) { |
|
205 | 205 | /** |
206 | 206 | * @see ParagonIE_Sodium_Compat::crypto_box_keypair() |
207 | 207 | * @return string |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
214 | 214 | } |
215 | 215 | } |
216 | -if (!is_callable('\\Sodium\\crypto_box_keypair_from_secretkey_and_publickey')) { |
|
216 | +if ( ! is_callable( '\\Sodium\\crypto_box_keypair_from_secretkey_and_publickey' ) ) { |
|
217 | 217 | /** |
218 | 218 | * @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey() |
219 | 219 | * @param string $sk |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | * @throws \SodiumException |
223 | 223 | * @throws \TypeError |
224 | 224 | */ |
225 | - function crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
225 | + function crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ) |
|
226 | 226 | { |
227 | - return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
227 | + return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ); |
|
228 | 228 | } |
229 | 229 | } |
230 | -if (!is_callable('\\Sodium\\crypto_box_open')) { |
|
230 | +if ( ! is_callable( '\\Sodium\\crypto_box_open' ) ) { |
|
231 | 231 | /** |
232 | 232 | * @see ParagonIE_Sodium_Compat::crypto_box_open() |
233 | 233 | * @param string $message |
@@ -235,18 +235,18 @@ discard block |
||
235 | 235 | * @param string $kp |
236 | 236 | * @return string|bool |
237 | 237 | */ |
238 | - function crypto_box_open($message, $nonce, $kp) |
|
238 | + function crypto_box_open( $message, $nonce, $kp ) |
|
239 | 239 | { |
240 | 240 | try { |
241 | - return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
242 | - } catch (\TypeError $ex) { |
|
241 | + return ParagonIE_Sodium_Compat::crypto_box_open( $message, $nonce, $kp ); |
|
242 | + } catch ( \TypeError $ex ) { |
|
243 | 243 | return false; |
244 | - } catch (\SodiumException $ex) { |
|
244 | + } catch ( \SodiumException $ex ) { |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | } |
248 | 248 | } |
249 | -if (!is_callable('\\Sodium\\crypto_box_publickey')) { |
|
249 | +if ( ! is_callable( '\\Sodium\\crypto_box_publickey' ) ) { |
|
250 | 250 | /** |
251 | 251 | * @see ParagonIE_Sodium_Compat::crypto_box_publickey() |
252 | 252 | * @param string $keypair |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | * @throws \SodiumException |
255 | 255 | * @throws \TypeError |
256 | 256 | */ |
257 | - function crypto_box_publickey($keypair) |
|
257 | + function crypto_box_publickey( $keypair ) |
|
258 | 258 | { |
259 | - return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
259 | + return ParagonIE_Sodium_Compat::crypto_box_publickey( $keypair ); |
|
260 | 260 | } |
261 | 261 | } |
262 | -if (!is_callable('\\Sodium\\crypto_box_publickey_from_secretkey')) { |
|
262 | +if ( ! is_callable( '\\Sodium\\crypto_box_publickey_from_secretkey' ) ) { |
|
263 | 263 | /** |
264 | 264 | * @see ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey() |
265 | 265 | * @param string $sk |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | * @throws \SodiumException |
268 | 268 | * @throws \TypeError |
269 | 269 | */ |
270 | - function crypto_box_publickey_from_secretkey($sk) |
|
270 | + function crypto_box_publickey_from_secretkey( $sk ) |
|
271 | 271 | { |
272 | - return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
272 | + return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey( $sk ); |
|
273 | 273 | } |
274 | 274 | } |
275 | -if (!is_callable('\\Sodium\\crypto_box_seal')) { |
|
275 | +if ( ! is_callable( '\\Sodium\\crypto_box_seal' ) ) { |
|
276 | 276 | /** |
277 | 277 | * @see ParagonIE_Sodium_Compat::crypto_box_seal_open() |
278 | 278 | * @param string $message |
@@ -281,30 +281,30 @@ discard block |
||
281 | 281 | * @throws \SodiumException |
282 | 282 | * @throws \TypeError |
283 | 283 | */ |
284 | - function crypto_box_seal($message, $publicKey) |
|
284 | + function crypto_box_seal( $message, $publicKey ) |
|
285 | 285 | { |
286 | - return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
286 | + return ParagonIE_Sodium_Compat::crypto_box_seal( $message, $publicKey ); |
|
287 | 287 | } |
288 | 288 | } |
289 | -if (!is_callable('\\Sodium\\crypto_box_seal_open')) { |
|
289 | +if ( ! is_callable( '\\Sodium\\crypto_box_seal_open' ) ) { |
|
290 | 290 | /** |
291 | 291 | * @see ParagonIE_Sodium_Compat::crypto_box_seal_open() |
292 | 292 | * @param string $message |
293 | 293 | * @param string $kp |
294 | 294 | * @return string|bool |
295 | 295 | */ |
296 | - function crypto_box_seal_open($message, $kp) |
|
296 | + function crypto_box_seal_open( $message, $kp ) |
|
297 | 297 | { |
298 | 298 | try { |
299 | - return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
300 | - } catch (\TypeError $ex) { |
|
299 | + return ParagonIE_Sodium_Compat::crypto_box_seal_open( $message, $kp ); |
|
300 | + } catch ( \TypeError $ex ) { |
|
301 | 301 | return false; |
302 | - } catch (\SodiumException $ex) { |
|
302 | + } catch ( \SodiumException $ex ) { |
|
303 | 303 | return false; |
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
307 | -if (!is_callable('\\Sodium\\crypto_box_secretkey')) { |
|
307 | +if ( ! is_callable( '\\Sodium\\crypto_box_secretkey' ) ) { |
|
308 | 308 | /** |
309 | 309 | * @see ParagonIE_Sodium_Compat::crypto_box_secretkey() |
310 | 310 | * @param string $keypair |
@@ -312,12 +312,12 @@ discard block |
||
312 | 312 | * @throws \SodiumException |
313 | 313 | * @throws \TypeError |
314 | 314 | */ |
315 | - function crypto_box_secretkey($keypair) |
|
315 | + function crypto_box_secretkey( $keypair ) |
|
316 | 316 | { |
317 | - return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
317 | + return ParagonIE_Sodium_Compat::crypto_box_secretkey( $keypair ); |
|
318 | 318 | } |
319 | 319 | } |
320 | -if (!is_callable('\\Sodium\\crypto_generichash')) { |
|
320 | +if ( ! is_callable( '\\Sodium\\crypto_generichash' ) ) { |
|
321 | 321 | /** |
322 | 322 | * @see ParagonIE_Sodium_Compat::crypto_generichash() |
323 | 323 | * @param string $message |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | * @throws \SodiumException |
328 | 328 | * @throws \TypeError |
329 | 329 | */ |
330 | - function crypto_generichash($message, $key = null, $outLen = 32) |
|
330 | + function crypto_generichash( $message, $key = null, $outLen = 32 ) |
|
331 | 331 | { |
332 | - return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
332 | + return ParagonIE_Sodium_Compat::crypto_generichash( $message, $key, $outLen ); |
|
333 | 333 | } |
334 | 334 | } |
335 | -if (!is_callable('\\Sodium\\crypto_generichash_final')) { |
|
335 | +if ( ! is_callable( '\\Sodium\\crypto_generichash_final' ) ) { |
|
336 | 336 | /** |
337 | 337 | * @see ParagonIE_Sodium_Compat::crypto_generichash_final() |
338 | 338 | * @param string|null $ctx |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * @throws \SodiumException |
342 | 342 | * @throws \TypeError |
343 | 343 | */ |
344 | - function crypto_generichash_final(&$ctx, $outputLength = 32) |
|
344 | + function crypto_generichash_final( &$ctx, $outputLength = 32 ) |
|
345 | 345 | { |
346 | - return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
346 | + return ParagonIE_Sodium_Compat::crypto_generichash_final( $ctx, $outputLength ); |
|
347 | 347 | } |
348 | 348 | } |
349 | -if (!is_callable('\\Sodium\\crypto_generichash_init')) { |
|
349 | +if ( ! is_callable( '\\Sodium\\crypto_generichash_init' ) ) { |
|
350 | 350 | /** |
351 | 351 | * @see ParagonIE_Sodium_Compat::crypto_generichash_init() |
352 | 352 | * @param string|null $key |
@@ -355,12 +355,12 @@ discard block |
||
355 | 355 | * @throws \SodiumException |
356 | 356 | * @throws \TypeError |
357 | 357 | */ |
358 | - function crypto_generichash_init($key = null, $outLen = 32) |
|
358 | + function crypto_generichash_init( $key = null, $outLen = 32 ) |
|
359 | 359 | { |
360 | - return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
360 | + return ParagonIE_Sodium_Compat::crypto_generichash_init( $key, $outLen ); |
|
361 | 361 | } |
362 | 362 | } |
363 | -if (!is_callable('\\Sodium\\crypto_generichash_update')) { |
|
363 | +if ( ! is_callable( '\\Sodium\\crypto_generichash_update' ) ) { |
|
364 | 364 | /** |
365 | 365 | * @see ParagonIE_Sodium_Compat::crypto_generichash_update() |
366 | 366 | * @param string|null $ctx |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | * @throws \SodiumException |
370 | 370 | * @throws \TypeError |
371 | 371 | */ |
372 | - function crypto_generichash_update(&$ctx, $message = '') |
|
372 | + function crypto_generichash_update( &$ctx, $message = '' ) |
|
373 | 373 | { |
374 | - ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
374 | + ParagonIE_Sodium_Compat::crypto_generichash_update( $ctx, $message ); |
|
375 | 375 | } |
376 | 376 | } |
377 | -if (!is_callable('\\Sodium\\crypto_kx')) { |
|
377 | +if ( ! is_callable( '\\Sodium\\crypto_kx' ) ) { |
|
378 | 378 | /** |
379 | 379 | * @see ParagonIE_Sodium_Compat::crypto_kx() |
380 | 380 | * @param string $my_secret |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | * @throws \SodiumException |
386 | 386 | * @throws \TypeError |
387 | 387 | */ |
388 | - function crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
388 | + function crypto_kx( $my_secret, $their_public, $client_public, $server_public ) |
|
389 | 389 | { |
390 | 390 | return ParagonIE_Sodium_Compat::crypto_kx( |
391 | 391 | $my_secret, |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | ); |
397 | 397 | } |
398 | 398 | } |
399 | -if (!is_callable('\\Sodium\\crypto_pwhash')) { |
|
399 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash' ) ) { |
|
400 | 400 | /** |
401 | 401 | * @see ParagonIE_Sodium_Compat::crypto_pwhash() |
402 | 402 | * @param int $outlen |
@@ -408,12 +408,12 @@ discard block |
||
408 | 408 | * @throws \SodiumException |
409 | 409 | * @throws \TypeError |
410 | 410 | */ |
411 | - function crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
411 | + function crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit ) |
|
412 | 412 | { |
413 | - return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
413 | + return ParagonIE_Sodium_Compat::crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit ); |
|
414 | 414 | } |
415 | 415 | } |
416 | -if (!is_callable('\\Sodium\\crypto_pwhash_str')) { |
|
416 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_str' ) ) { |
|
417 | 417 | /** |
418 | 418 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_str() |
419 | 419 | * @param string $passwd |
@@ -423,12 +423,12 @@ discard block |
||
423 | 423 | * @throws \SodiumException |
424 | 424 | * @throws \TypeError |
425 | 425 | */ |
426 | - function crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
426 | + function crypto_pwhash_str( $passwd, $opslimit, $memlimit ) |
|
427 | 427 | { |
428 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
428 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str( $passwd, $opslimit, $memlimit ); |
|
429 | 429 | } |
430 | 430 | } |
431 | -if (!is_callable('\\Sodium\\crypto_pwhash_str_verify')) { |
|
431 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_str_verify' ) ) { |
|
432 | 432 | /** |
433 | 433 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_str_verify() |
434 | 434 | * @param string $passwd |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | * @throws \SodiumException |
438 | 438 | * @throws \TypeError |
439 | 439 | */ |
440 | - function crypto_pwhash_str_verify($passwd, $hash) |
|
440 | + function crypto_pwhash_str_verify( $passwd, $hash ) |
|
441 | 441 | { |
442 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
442 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify( $passwd, $hash ); |
|
443 | 443 | } |
444 | 444 | } |
445 | -if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256')) { |
|
445 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_scryptsalsa208sha256' ) ) { |
|
446 | 446 | /** |
447 | 447 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256() |
448 | 448 | * @param int $outlen |
@@ -454,12 +454,12 @@ discard block |
||
454 | 454 | * @throws \SodiumException |
455 | 455 | * @throws \TypeError |
456 | 456 | */ |
457 | - function crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
457 | + function crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ) |
|
458 | 458 | { |
459 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
459 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ); |
|
460 | 460 | } |
461 | 461 | } |
462 | -if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str')) { |
|
462 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str' ) ) { |
|
463 | 463 | /** |
464 | 464 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str() |
465 | 465 | * @param string $passwd |
@@ -469,12 +469,12 @@ discard block |
||
469 | 469 | * @throws \SodiumException |
470 | 470 | * @throws \TypeError |
471 | 471 | */ |
472 | - function crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
472 | + function crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ) |
|
473 | 473 | { |
474 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
474 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ); |
|
475 | 475 | } |
476 | 476 | } |
477 | -if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str_verify')) { |
|
477 | +if ( ! is_callable( '\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str_verify' ) ) { |
|
478 | 478 | /** |
479 | 479 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify() |
480 | 480 | * @param string $passwd |
@@ -483,12 +483,12 @@ discard block |
||
483 | 483 | * @throws \SodiumException |
484 | 484 | * @throws \TypeError |
485 | 485 | */ |
486 | - function crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
486 | + function crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ) |
|
487 | 487 | { |
488 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
488 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ); |
|
489 | 489 | } |
490 | 490 | } |
491 | -if (!is_callable('\\Sodium\\crypto_scalarmult')) { |
|
491 | +if ( ! is_callable( '\\Sodium\\crypto_scalarmult' ) ) { |
|
492 | 492 | /** |
493 | 493 | * @see ParagonIE_Sodium_Compat::crypto_scalarmult() |
494 | 494 | * @param string $n |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | * @throws \SodiumException |
498 | 498 | * @throws \TypeError |
499 | 499 | */ |
500 | - function crypto_scalarmult($n, $p) |
|
500 | + function crypto_scalarmult( $n, $p ) |
|
501 | 501 | { |
502 | - return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
502 | + return ParagonIE_Sodium_Compat::crypto_scalarmult( $n, $p ); |
|
503 | 503 | } |
504 | 504 | } |
505 | -if (!is_callable('\\Sodium\\crypto_scalarmult_base')) { |
|
505 | +if ( ! is_callable( '\\Sodium\\crypto_scalarmult_base' ) ) { |
|
506 | 506 | /** |
507 | 507 | * @see ParagonIE_Sodium_Compat::crypto_scalarmult_base() |
508 | 508 | * @param string $n |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | * @throws \SodiumException |
511 | 511 | * @throws \TypeError |
512 | 512 | */ |
513 | - function crypto_scalarmult_base($n) |
|
513 | + function crypto_scalarmult_base( $n ) |
|
514 | 514 | { |
515 | - return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
515 | + return ParagonIE_Sodium_Compat::crypto_scalarmult_base( $n ); |
|
516 | 516 | } |
517 | 517 | } |
518 | -if (!is_callable('\\Sodium\\crypto_secretbox')) { |
|
518 | +if ( ! is_callable( '\\Sodium\\crypto_secretbox' ) ) { |
|
519 | 519 | /** |
520 | 520 | * @see ParagonIE_Sodium_Compat::crypto_secretbox() |
521 | 521 | * @param string $message |
@@ -525,12 +525,12 @@ discard block |
||
525 | 525 | * @throws \SodiumException |
526 | 526 | * @throws \TypeError |
527 | 527 | */ |
528 | - function crypto_secretbox($message, $nonce, $key) |
|
528 | + function crypto_secretbox( $message, $nonce, $key ) |
|
529 | 529 | { |
530 | - return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
530 | + return ParagonIE_Sodium_Compat::crypto_secretbox( $message, $nonce, $key ); |
|
531 | 531 | } |
532 | 532 | } |
533 | -if (!is_callable('\\Sodium\\crypto_secretbox_open')) { |
|
533 | +if ( ! is_callable( '\\Sodium\\crypto_secretbox_open' ) ) { |
|
534 | 534 | /** |
535 | 535 | * @see ParagonIE_Sodium_Compat::crypto_secretbox_open() |
536 | 536 | * @param string $message |
@@ -538,18 +538,18 @@ discard block |
||
538 | 538 | * @param string $key |
539 | 539 | * @return string|bool |
540 | 540 | */ |
541 | - function crypto_secretbox_open($message, $nonce, $key) |
|
541 | + function crypto_secretbox_open( $message, $nonce, $key ) |
|
542 | 542 | { |
543 | 543 | try { |
544 | - return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
545 | - } catch (\TypeError $ex) { |
|
544 | + return ParagonIE_Sodium_Compat::crypto_secretbox_open( $message, $nonce, $key ); |
|
545 | + } catch ( \TypeError $ex ) { |
|
546 | 546 | return false; |
547 | - } catch (\SodiumException $ex) { |
|
547 | + } catch ( \SodiumException $ex ) { |
|
548 | 548 | return false; |
549 | 549 | } |
550 | 550 | } |
551 | 551 | } |
552 | -if (!is_callable('\\Sodium\\crypto_shorthash')) { |
|
552 | +if ( ! is_callable( '\\Sodium\\crypto_shorthash' ) ) { |
|
553 | 553 | /** |
554 | 554 | * @see ParagonIE_Sodium_Compat::crypto_shorthash() |
555 | 555 | * @param string $message |
@@ -558,12 +558,12 @@ discard block |
||
558 | 558 | * @throws \SodiumException |
559 | 559 | * @throws \TypeError |
560 | 560 | */ |
561 | - function crypto_shorthash($message, $key = '') |
|
561 | + function crypto_shorthash( $message, $key = '' ) |
|
562 | 562 | { |
563 | - return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
563 | + return ParagonIE_Sodium_Compat::crypto_shorthash( $message, $key ); |
|
564 | 564 | } |
565 | 565 | } |
566 | -if (!is_callable('\\Sodium\\crypto_sign')) { |
|
566 | +if ( ! is_callable( '\\Sodium\\crypto_sign' ) ) { |
|
567 | 567 | /** |
568 | 568 | * @see ParagonIE_Sodium_Compat::crypto_sign() |
569 | 569 | * @param string $message |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | * @throws \SodiumException |
573 | 573 | * @throws \TypeError |
574 | 574 | */ |
575 | - function crypto_sign($message, $sk) |
|
575 | + function crypto_sign( $message, $sk ) |
|
576 | 576 | { |
577 | - return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
577 | + return ParagonIE_Sodium_Compat::crypto_sign( $message, $sk ); |
|
578 | 578 | } |
579 | 579 | } |
580 | -if (!is_callable('\\Sodium\\crypto_sign_detached')) { |
|
580 | +if ( ! is_callable( '\\Sodium\\crypto_sign_detached' ) ) { |
|
581 | 581 | /** |
582 | 582 | * @see ParagonIE_Sodium_Compat::crypto_sign_detached() |
583 | 583 | * @param string $message |
@@ -586,12 +586,12 @@ discard block |
||
586 | 586 | * @throws \SodiumException |
587 | 587 | * @throws \TypeError |
588 | 588 | */ |
589 | - function crypto_sign_detached($message, $sk) |
|
589 | + function crypto_sign_detached( $message, $sk ) |
|
590 | 590 | { |
591 | - return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
591 | + return ParagonIE_Sodium_Compat::crypto_sign_detached( $message, $sk ); |
|
592 | 592 | } |
593 | 593 | } |
594 | -if (!is_callable('\\Sodium\\crypto_sign_keypair')) { |
|
594 | +if ( ! is_callable( '\\Sodium\\crypto_sign_keypair' ) ) { |
|
595 | 595 | /** |
596 | 596 | * @see ParagonIE_Sodium_Compat::crypto_sign_keypair() |
597 | 597 | * @return string |
@@ -603,25 +603,25 @@ discard block |
||
603 | 603 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
604 | 604 | } |
605 | 605 | } |
606 | -if (!is_callable('\\Sodium\\crypto_sign_open')) { |
|
606 | +if ( ! is_callable( '\\Sodium\\crypto_sign_open' ) ) { |
|
607 | 607 | /** |
608 | 608 | * @see ParagonIE_Sodium_Compat::crypto_sign_open() |
609 | 609 | * @param string $signedMessage |
610 | 610 | * @param string $pk |
611 | 611 | * @return string|bool |
612 | 612 | */ |
613 | - function crypto_sign_open($signedMessage, $pk) |
|
613 | + function crypto_sign_open( $signedMessage, $pk ) |
|
614 | 614 | { |
615 | 615 | try { |
616 | - return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
617 | - } catch (\TypeError $ex) { |
|
616 | + return ParagonIE_Sodium_Compat::crypto_sign_open( $signedMessage, $pk ); |
|
617 | + } catch ( \TypeError $ex ) { |
|
618 | 618 | return false; |
619 | - } catch (\SodiumException $ex) { |
|
619 | + } catch ( \SodiumException $ex ) { |
|
620 | 620 | return false; |
621 | 621 | } |
622 | 622 | } |
623 | 623 | } |
624 | -if (!is_callable('\\Sodium\\crypto_sign_publickey')) { |
|
624 | +if ( ! is_callable( '\\Sodium\\crypto_sign_publickey' ) ) { |
|
625 | 625 | /** |
626 | 626 | * @see ParagonIE_Sodium_Compat::crypto_sign_publickey() |
627 | 627 | * @param string $keypair |
@@ -629,12 +629,12 @@ discard block |
||
629 | 629 | * @throws \SodiumException |
630 | 630 | * @throws \TypeError |
631 | 631 | */ |
632 | - function crypto_sign_publickey($keypair) |
|
632 | + function crypto_sign_publickey( $keypair ) |
|
633 | 633 | { |
634 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
634 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey( $keypair ); |
|
635 | 635 | } |
636 | 636 | } |
637 | -if (!is_callable('\\Sodium\\crypto_sign_publickey_from_secretkey')) { |
|
637 | +if ( ! is_callable( '\\Sodium\\crypto_sign_publickey_from_secretkey' ) ) { |
|
638 | 638 | /** |
639 | 639 | * @see ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey() |
640 | 640 | * @param string $sk |
@@ -642,12 +642,12 @@ discard block |
||
642 | 642 | * @throws \SodiumException |
643 | 643 | * @throws \TypeError |
644 | 644 | */ |
645 | - function crypto_sign_publickey_from_secretkey($sk) |
|
645 | + function crypto_sign_publickey_from_secretkey( $sk ) |
|
646 | 646 | { |
647 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
647 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey( $sk ); |
|
648 | 648 | } |
649 | 649 | } |
650 | -if (!is_callable('\\Sodium\\crypto_sign_secretkey')) { |
|
650 | +if ( ! is_callable( '\\Sodium\\crypto_sign_secretkey' ) ) { |
|
651 | 651 | /** |
652 | 652 | * @see ParagonIE_Sodium_Compat::crypto_sign_secretkey() |
653 | 653 | * @param string $keypair |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | * @throws \SodiumException |
656 | 656 | * @throws \TypeError |
657 | 657 | */ |
658 | - function crypto_sign_secretkey($keypair) |
|
658 | + function crypto_sign_secretkey( $keypair ) |
|
659 | 659 | { |
660 | - return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
660 | + return ParagonIE_Sodium_Compat::crypto_sign_secretkey( $keypair ); |
|
661 | 661 | } |
662 | 662 | } |
663 | -if (!is_callable('\\Sodium\\crypto_sign_seed_keypair')) { |
|
663 | +if ( ! is_callable( '\\Sodium\\crypto_sign_seed_keypair' ) ) { |
|
664 | 664 | /** |
665 | 665 | * @see ParagonIE_Sodium_Compat::crypto_sign_seed_keypair() |
666 | 666 | * @param string $seed |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | * @throws \SodiumException |
669 | 669 | * @throws \TypeError |
670 | 670 | */ |
671 | - function crypto_sign_seed_keypair($seed) |
|
671 | + function crypto_sign_seed_keypair( $seed ) |
|
672 | 672 | { |
673 | - return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
673 | + return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair( $seed ); |
|
674 | 674 | } |
675 | 675 | } |
676 | -if (!is_callable('\\Sodium\\crypto_sign_verify_detached')) { |
|
676 | +if ( ! is_callable( '\\Sodium\\crypto_sign_verify_detached' ) ) { |
|
677 | 677 | /** |
678 | 678 | * @see ParagonIE_Sodium_Compat::crypto_sign_verify_detached() |
679 | 679 | * @param string $signature |
@@ -683,12 +683,12 @@ discard block |
||
683 | 683 | * @throws \SodiumException |
684 | 684 | * @throws \TypeError |
685 | 685 | */ |
686 | - function crypto_sign_verify_detached($signature, $message, $pk) |
|
686 | + function crypto_sign_verify_detached( $signature, $message, $pk ) |
|
687 | 687 | { |
688 | - return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
688 | + return ParagonIE_Sodium_Compat::crypto_sign_verify_detached( $signature, $message, $pk ); |
|
689 | 689 | } |
690 | 690 | } |
691 | -if (!is_callable('\\Sodium\\crypto_sign_ed25519_pk_to_curve25519')) { |
|
691 | +if ( ! is_callable( '\\Sodium\\crypto_sign_ed25519_pk_to_curve25519' ) ) { |
|
692 | 692 | /** |
693 | 693 | * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519() |
694 | 694 | * @param string $pk |
@@ -696,12 +696,12 @@ discard block |
||
696 | 696 | * @throws \SodiumException |
697 | 697 | * @throws \TypeError |
698 | 698 | */ |
699 | - function crypto_sign_ed25519_pk_to_curve25519($pk) |
|
699 | + function crypto_sign_ed25519_pk_to_curve25519( $pk ) |
|
700 | 700 | { |
701 | - return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($pk); |
|
701 | + return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519( $pk ); |
|
702 | 702 | } |
703 | 703 | } |
704 | -if (!is_callable('\\Sodium\\crypto_sign_ed25519_sk_to_curve25519')) { |
|
704 | +if ( ! is_callable( '\\Sodium\\crypto_sign_ed25519_sk_to_curve25519' ) ) { |
|
705 | 705 | /** |
706 | 706 | * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519() |
707 | 707 | * @param string $sk |
@@ -709,12 +709,12 @@ discard block |
||
709 | 709 | * @throws \SodiumException |
710 | 710 | * @throws \TypeError |
711 | 711 | */ |
712 | - function crypto_sign_ed25519_sk_to_curve25519($sk) |
|
712 | + function crypto_sign_ed25519_sk_to_curve25519( $sk ) |
|
713 | 713 | { |
714 | - return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
|
714 | + return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519( $sk ); |
|
715 | 715 | } |
716 | 716 | } |
717 | -if (!is_callable('\\Sodium\\crypto_stream')) { |
|
717 | +if ( ! is_callable( '\\Sodium\\crypto_stream' ) ) { |
|
718 | 718 | /** |
719 | 719 | * @see ParagonIE_Sodium_Compat::crypto_stream() |
720 | 720 | * @param int $len |
@@ -724,12 +724,12 @@ discard block |
||
724 | 724 | * @throws \SodiumException |
725 | 725 | * @throws \TypeError |
726 | 726 | */ |
727 | - function crypto_stream($len, $nonce, $key) |
|
727 | + function crypto_stream( $len, $nonce, $key ) |
|
728 | 728 | { |
729 | - return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
729 | + return ParagonIE_Sodium_Compat::crypto_stream( $len, $nonce, $key ); |
|
730 | 730 | } |
731 | 731 | } |
732 | -if (!is_callable('\\Sodium\\crypto_stream_xor')) { |
|
732 | +if ( ! is_callable( '\\Sodium\\crypto_stream_xor' ) ) { |
|
733 | 733 | /** |
734 | 734 | * @see ParagonIE_Sodium_Compat::crypto_stream_xor() |
735 | 735 | * @param string $message |
@@ -739,12 +739,12 @@ discard block |
||
739 | 739 | * @throws \SodiumException |
740 | 740 | * @throws \TypeError |
741 | 741 | */ |
742 | - function crypto_stream_xor($message, $nonce, $key) |
|
742 | + function crypto_stream_xor( $message, $nonce, $key ) |
|
743 | 743 | { |
744 | - return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
744 | + return ParagonIE_Sodium_Compat::crypto_stream_xor( $message, $nonce, $key ); |
|
745 | 745 | } |
746 | 746 | } |
747 | -if (!is_callable('\\Sodium\\hex2bin')) { |
|
747 | +if ( ! is_callable( '\\Sodium\\hex2bin' ) ) { |
|
748 | 748 | /** |
749 | 749 | * @see ParagonIE_Sodium_Compat::hex2bin() |
750 | 750 | * @param string $string |
@@ -752,12 +752,12 @@ discard block |
||
752 | 752 | * @throws \SodiumException |
753 | 753 | * @throws \TypeError |
754 | 754 | */ |
755 | - function hex2bin($string) |
|
755 | + function hex2bin( $string ) |
|
756 | 756 | { |
757 | - return ParagonIE_Sodium_Compat::hex2bin($string); |
|
757 | + return ParagonIE_Sodium_Compat::hex2bin( $string ); |
|
758 | 758 | } |
759 | 759 | } |
760 | -if (!is_callable('\\Sodium\\memcmp')) { |
|
760 | +if ( ! is_callable( '\\Sodium\\memcmp' ) ) { |
|
761 | 761 | /** |
762 | 762 | * @see ParagonIE_Sodium_Compat::memcmp() |
763 | 763 | * @param string $a |
@@ -766,12 +766,12 @@ discard block |
||
766 | 766 | * @throws \SodiumException |
767 | 767 | * @throws \TypeError |
768 | 768 | */ |
769 | - function memcmp($a, $b) |
|
769 | + function memcmp( $a, $b ) |
|
770 | 770 | { |
771 | - return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
771 | + return ParagonIE_Sodium_Compat::memcmp( $a, $b ); |
|
772 | 772 | } |
773 | 773 | } |
774 | -if (!is_callable('\\Sodium\\memzero')) { |
|
774 | +if ( ! is_callable( '\\Sodium\\memzero' ) ) { |
|
775 | 775 | /** |
776 | 776 | * @see ParagonIE_Sodium_Compat::memzero() |
777 | 777 | * @param string $str |
@@ -779,25 +779,25 @@ discard block |
||
779 | 779 | * @throws \SodiumException |
780 | 780 | * @throws \TypeError |
781 | 781 | */ |
782 | - function memzero(&$str) |
|
782 | + function memzero( &$str ) |
|
783 | 783 | { |
784 | - ParagonIE_Sodium_Compat::memzero($str); |
|
784 | + ParagonIE_Sodium_Compat::memzero( $str ); |
|
785 | 785 | } |
786 | 786 | } |
787 | -if (!is_callable('\\Sodium\\randombytes_buf')) { |
|
787 | +if ( ! is_callable( '\\Sodium\\randombytes_buf' ) ) { |
|
788 | 788 | /** |
789 | 789 | * @see ParagonIE_Sodium_Compat::randombytes_buf() |
790 | 790 | * @param int $amount |
791 | 791 | * @return string |
792 | 792 | * @throws \TypeError |
793 | 793 | */ |
794 | - function randombytes_buf($amount) |
|
794 | + function randombytes_buf( $amount ) |
|
795 | 795 | { |
796 | - return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
796 | + return ParagonIE_Sodium_Compat::randombytes_buf( $amount ); |
|
797 | 797 | } |
798 | 798 | } |
799 | 799 | |
800 | -if (!is_callable('\\Sodium\\randombytes_uniform')) { |
|
800 | +if ( ! is_callable( '\\Sodium\\randombytes_uniform' ) ) { |
|
801 | 801 | /** |
802 | 802 | * @see ParagonIE_Sodium_Compat::randombytes_uniform() |
803 | 803 | * @param int $upperLimit |
@@ -805,13 +805,13 @@ discard block |
||
805 | 805 | * @throws \SodiumException |
806 | 806 | * @throws \Error |
807 | 807 | */ |
808 | - function randombytes_uniform($upperLimit) |
|
808 | + function randombytes_uniform( $upperLimit ) |
|
809 | 809 | { |
810 | - return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
810 | + return ParagonIE_Sodium_Compat::randombytes_uniform( $upperLimit ); |
|
811 | 811 | } |
812 | 812 | } |
813 | 813 | |
814 | -if (!is_callable('\\Sodium\\randombytes_random16')) { |
|
814 | +if ( ! is_callable( '\\Sodium\\randombytes_random16' ) ) { |
|
815 | 815 | /** |
816 | 816 | * @see ParagonIE_Sodium_Compat::randombytes_random16() |
817 | 817 | * @return int |
@@ -822,6 +822,6 @@ discard block |
||
822 | 822 | } |
823 | 823 | } |
824 | 824 | |
825 | -if (!defined('\\Sodium\\CRYPTO_AUTH_BYTES')) { |
|
826 | - require_once dirname(__FILE__) . '/constants.php'; |
|
825 | +if ( ! defined( '\\Sodium\\CRYPTO_AUTH_BYTES' ) ) { |
|
826 | + require_once dirname( __FILE__ ) . '/constants.php'; |
|
827 | 827 | } |
@@ -1,44 +1,44 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_BYTES')) { |
|
3 | +if ( ! defined( 'SODIUM_CRYPTO_CORE_RISTRETTO255_BYTES' ) ) { |
|
4 | 4 | define( |
5 | 5 | 'SODIUM_CRYPTO_CORE_RISTRETTO255_BYTES', |
6 | 6 | ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_BYTES |
7 | 7 | ); |
8 | - define('SODIUM_COMPAT_POLYFILLED_RISTRETTO255', true); |
|
8 | + define( 'SODIUM_COMPAT_POLYFILLED_RISTRETTO255', true ); |
|
9 | 9 | } |
10 | -if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_HASHBYTES')) { |
|
10 | +if ( ! defined( 'SODIUM_CRYPTO_CORE_RISTRETTO255_HASHBYTES' ) ) { |
|
11 | 11 | define( |
12 | 12 | 'SODIUM_CRYPTO_CORE_RISTRETTO255_HASHBYTES', |
13 | 13 | ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_HASHBYTES |
14 | 14 | ); |
15 | 15 | } |
16 | -if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_SCALARBYTES')) { |
|
16 | +if ( ! defined( 'SODIUM_CRYPTO_CORE_RISTRETTO255_SCALARBYTES' ) ) { |
|
17 | 17 | define( |
18 | 18 | 'SODIUM_CRYPTO_CORE_RISTRETTO255_SCALARBYTES', |
19 | 19 | ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_SCALARBYTES |
20 | 20 | ); |
21 | 21 | } |
22 | -if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES')) { |
|
22 | +if ( ! defined( 'SODIUM_CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES' ) ) { |
|
23 | 23 | define( |
24 | 24 | 'SODIUM_CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES', |
25 | 25 | ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES |
26 | 26 | ); |
27 | 27 | } |
28 | -if (!defined('SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES')) { |
|
28 | +if ( ! defined( 'SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES' ) ) { |
|
29 | 29 | define( |
30 | 30 | 'SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES', |
31 | 31 | ParagonIE_Sodium_Compat::CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES |
32 | 32 | ); |
33 | 33 | } |
34 | -if (!defined('SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_BYTES')) { |
|
34 | +if ( ! defined( 'SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_BYTES' ) ) { |
|
35 | 35 | define( |
36 | 36 | 'SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_BYTES', |
37 | 37 | ParagonIE_Sodium_Compat::CRYPTO_SCALARMULT_RISTRETTO255_BYTES |
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
41 | -if (!is_callable('sodium_crypto_core_ristretto255_add')) { |
|
41 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_add' ) ) { |
|
42 | 42 | /** |
43 | 43 | * @see ParagonIE_Sodium_Compat::ristretto255_add() |
44 | 44 | * |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | * @return string |
48 | 48 | * @throws SodiumException |
49 | 49 | */ |
50 | - function sodium_crypto_core_ristretto255_add($p, $q) |
|
50 | + function sodium_crypto_core_ristretto255_add( $p, $q ) |
|
51 | 51 | { |
52 | - return ParagonIE_Sodium_Compat::ristretto255_add($p, $q, true); |
|
52 | + return ParagonIE_Sodium_Compat::ristretto255_add( $p, $q, true ); |
|
53 | 53 | } |
54 | 54 | } |
55 | -if (!is_callable('sodium_crypto_core_ristretto255_from_hash')) { |
|
55 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_from_hash' ) ) { |
|
56 | 56 | /** |
57 | 57 | * @see ParagonIE_Sodium_Compat::ristretto255_from_hash() |
58 | 58 | * |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | * @return string |
61 | 61 | * @throws SodiumException |
62 | 62 | */ |
63 | - function sodium_crypto_core_ristretto255_from_hash($r) |
|
63 | + function sodium_crypto_core_ristretto255_from_hash( $r ) |
|
64 | 64 | { |
65 | - return ParagonIE_Sodium_Compat::ristretto255_from_hash($r, true); |
|
65 | + return ParagonIE_Sodium_Compat::ristretto255_from_hash( $r, true ); |
|
66 | 66 | } |
67 | 67 | } |
68 | -if (!is_callable('sodium_crypto_core_ristretto255_is_valid_point')) { |
|
68 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_is_valid_point' ) ) { |
|
69 | 69 | /** |
70 | 70 | * @see ParagonIE_Sodium_Compat::ristretto255_is_valid_point() |
71 | 71 | * |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | * @return bool |
74 | 74 | * @throws SodiumException |
75 | 75 | */ |
76 | - function sodium_crypto_core_ristretto255_is_valid_point($p) |
|
76 | + function sodium_crypto_core_ristretto255_is_valid_point( $p ) |
|
77 | 77 | { |
78 | - return ParagonIE_Sodium_Compat::ristretto255_is_valid_point($p, true); |
|
78 | + return ParagonIE_Sodium_Compat::ristretto255_is_valid_point( $p, true ); |
|
79 | 79 | } |
80 | 80 | } |
81 | -if (!is_callable('sodium_crypto_core_ristretto255_random')) { |
|
81 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_random' ) ) { |
|
82 | 82 | /** |
83 | 83 | * @see ParagonIE_Sodium_Compat::ristretto255_random() |
84 | 84 | * |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function sodium_crypto_core_ristretto255_random() |
89 | 89 | { |
90 | - return ParagonIE_Sodium_Compat::ristretto255_random(true); |
|
90 | + return ParagonIE_Sodium_Compat::ristretto255_random( true ); |
|
91 | 91 | } |
92 | 92 | } |
93 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_add')) { |
|
93 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_add' ) ) { |
|
94 | 94 | /** |
95 | 95 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_add() |
96 | 96 | * |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | * @throws SodiumException |
101 | 101 | */ |
102 | - function sodium_crypto_core_ristretto255_scalar_add($p, $q) |
|
102 | + function sodium_crypto_core_ristretto255_scalar_add( $p, $q ) |
|
103 | 103 | { |
104 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_add($p, $q, true); |
|
104 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_add( $p, $q, true ); |
|
105 | 105 | } |
106 | 106 | } |
107 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_complement')) { |
|
107 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_complement' ) ) { |
|
108 | 108 | /** |
109 | 109 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_complement() |
110 | 110 | * |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | * @return string |
113 | 113 | * @throws SodiumException |
114 | 114 | */ |
115 | - function sodium_crypto_core_ristretto255_scalar_complement($p) |
|
115 | + function sodium_crypto_core_ristretto255_scalar_complement( $p ) |
|
116 | 116 | { |
117 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_complement($p, true); |
|
117 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_complement( $p, true ); |
|
118 | 118 | } |
119 | 119 | } |
120 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_invert')) { |
|
120 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_invert' ) ) { |
|
121 | 121 | /** |
122 | 122 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_invert() |
123 | 123 | * |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | * @return string |
126 | 126 | * @throws SodiumException |
127 | 127 | */ |
128 | - function sodium_crypto_core_ristretto255_scalar_invert($p) |
|
128 | + function sodium_crypto_core_ristretto255_scalar_invert( $p ) |
|
129 | 129 | { |
130 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_invert($p, true); |
|
130 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_invert( $p, true ); |
|
131 | 131 | } |
132 | 132 | } |
133 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_mul')) { |
|
133 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_mul' ) ) { |
|
134 | 134 | /** |
135 | 135 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_mul() |
136 | 136 | * |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | * @return string |
140 | 140 | * @throws SodiumException |
141 | 141 | */ |
142 | - function sodium_crypto_core_ristretto255_scalar_mul($p, $q) |
|
142 | + function sodium_crypto_core_ristretto255_scalar_mul( $p, $q ) |
|
143 | 143 | { |
144 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_mul($p, $q, true); |
|
144 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_mul( $p, $q, true ); |
|
145 | 145 | } |
146 | 146 | } |
147 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_negate')) { |
|
147 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_negate' ) ) { |
|
148 | 148 | /** |
149 | 149 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_negate() |
150 | 150 | * |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | * @return string |
153 | 153 | * @throws SodiumException |
154 | 154 | */ |
155 | - function sodium_crypto_core_ristretto255_scalar_negate($p) |
|
155 | + function sodium_crypto_core_ristretto255_scalar_negate( $p ) |
|
156 | 156 | { |
157 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_negate($p, true); |
|
157 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_negate( $p, true ); |
|
158 | 158 | } |
159 | 159 | } |
160 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_random')) { |
|
160 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_random' ) ) { |
|
161 | 161 | /** |
162 | 162 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_random() |
163 | 163 | * |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function sodium_crypto_core_ristretto255_scalar_random() |
168 | 168 | { |
169 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_random(true); |
|
169 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_random( true ); |
|
170 | 170 | } |
171 | 171 | } |
172 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_reduce')) { |
|
172 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_reduce' ) ) { |
|
173 | 173 | /** |
174 | 174 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_reduce() |
175 | 175 | * |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * @return string |
178 | 178 | * @throws SodiumException |
179 | 179 | */ |
180 | - function sodium_crypto_core_ristretto255_scalar_reduce($p) |
|
180 | + function sodium_crypto_core_ristretto255_scalar_reduce( $p ) |
|
181 | 181 | { |
182 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_reduce($p, true); |
|
182 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_reduce( $p, true ); |
|
183 | 183 | } |
184 | 184 | } |
185 | -if (!is_callable('sodium_crypto_core_ristretto255_scalar_sub')) { |
|
185 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_scalar_sub' ) ) { |
|
186 | 186 | /** |
187 | 187 | * @see ParagonIE_Sodium_Compat::ristretto255_scalar_sub() |
188 | 188 | * |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | * @return string |
192 | 192 | * @throws SodiumException |
193 | 193 | */ |
194 | - function sodium_crypto_core_ristretto255_scalar_sub($p, $q) |
|
194 | + function sodium_crypto_core_ristretto255_scalar_sub( $p, $q ) |
|
195 | 195 | { |
196 | - return ParagonIE_Sodium_Compat::ristretto255_scalar_sub($p, $q, true); |
|
196 | + return ParagonIE_Sodium_Compat::ristretto255_scalar_sub( $p, $q, true ); |
|
197 | 197 | } |
198 | 198 | } |
199 | -if (!is_callable('sodium_crypto_core_ristretto255_sub')) { |
|
199 | +if ( ! is_callable( 'sodium_crypto_core_ristretto255_sub' ) ) { |
|
200 | 200 | /** |
201 | 201 | * @see ParagonIE_Sodium_Compat::ristretto255_sub() |
202 | 202 | * |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * @return string |
206 | 206 | * @throws SodiumException |
207 | 207 | */ |
208 | - function sodium_crypto_core_ristretto255_sub($p, $q) |
|
208 | + function sodium_crypto_core_ristretto255_sub( $p, $q ) |
|
209 | 209 | { |
210 | - return ParagonIE_Sodium_Compat::ristretto255_sub($p, $q, true); |
|
210 | + return ParagonIE_Sodium_Compat::ristretto255_sub( $p, $q, true ); |
|
211 | 211 | } |
212 | 212 | } |
213 | -if (!is_callable('sodium_crypto_scalarmult_ristretto255')) { |
|
213 | +if ( ! is_callable( 'sodium_crypto_scalarmult_ristretto255' ) ) { |
|
214 | 214 | /** |
215 | 215 | * @see ParagonIE_Sodium_Compat::crypto_scalarmult_ristretto255() |
216 | 216 | * @param string $n |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | * @throws SodiumException |
220 | 220 | * @throws TypeError |
221 | 221 | */ |
222 | - function sodium_crypto_scalarmult_ristretto255($n, $p) |
|
222 | + function sodium_crypto_scalarmult_ristretto255( $n, $p ) |
|
223 | 223 | { |
224 | - return ParagonIE_Sodium_Compat::scalarmult_ristretto255($n, $p, true); |
|
224 | + return ParagonIE_Sodium_Compat::scalarmult_ristretto255( $n, $p, true ); |
|
225 | 225 | } |
226 | 226 | } |
227 | -if (!is_callable('sodium_crypto_scalarmult_ristretto255_base')) { |
|
227 | +if ( ! is_callable( 'sodium_crypto_scalarmult_ristretto255_base' ) ) { |
|
228 | 228 | /** |
229 | 229 | * @see ParagonIE_Sodium_Compat::crypto_scalarmult_ristretto255_base() |
230 | 230 | * @param string $n |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @throws SodiumException |
233 | 233 | * @throws TypeError |
234 | 234 | */ |
235 | - function sodium_crypto_scalarmult_ristretto255_base($n) |
|
235 | + function sodium_crypto_scalarmult_ristretto255_base( $n ) |
|
236 | 236 | { |
237 | - return ParagonIE_Sodium_Compat::scalarmult_ristretto255_base($n, true); |
|
237 | + return ParagonIE_Sodium_Compat::scalarmult_ristretto255_base( $n, true ); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | \ No newline at end of file |