@@ -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 |
@@ -1,7 +1,7 @@ |
||
| 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 | |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once dirname(dirname(__FILE__)) . '/autoload.php'; |
|
| 3 | +require_once dirname( dirname( __FILE__ ) ) . '/autoload.php'; |
|
| 4 | 4 | |
| 5 | -if (PHP_VERSION_ID < 50300) { |
|
| 5 | +if ( PHP_VERSION_ID < 50300 ) { |
|
| 6 | 6 | return; |
| 7 | 7 | } |
| 8 | 8 | |
@@ -20,27 +20,27 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * $x = Compat::crypto_aead_xchacha20poly1305_encrypt(...$args); |
| 22 | 22 | */ |
| 23 | -spl_autoload_register(function ($class) { |
|
| 24 | - if ($class[0] === '\\') { |
|
| 25 | - $class = substr($class, 1); |
|
| 23 | +spl_autoload_register( function( $class ) { |
|
| 24 | + if ( $class[ 0 ] === '\\' ) { |
|
| 25 | + $class = substr( $class, 1 ); |
|
| 26 | 26 | } |
| 27 | 27 | $namespace = 'ParagonIE\\Sodium'; |
| 28 | 28 | // Does the class use the namespace prefix? |
| 29 | - $len = strlen($namespace); |
|
| 30 | - if (strncmp($namespace, $class, $len) !== 0) { |
|
| 29 | + $len = strlen( $namespace ); |
|
| 30 | + if ( strncmp( $namespace, $class, $len ) !== 0 ) { |
|
| 31 | 31 | // no, move to the next registered autoloader |
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Get the relative class name |
| 36 | - $relative_class = substr($class, $len); |
|
| 36 | + $relative_class = substr( $class, $len ); |
|
| 37 | 37 | |
| 38 | 38 | // Replace the namespace prefix with the base directory, replace namespace |
| 39 | 39 | // separators with directory separators in the relative class name, append |
| 40 | 40 | // with .php |
| 41 | - $file = dirname(dirname(__FILE__)) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 41 | + $file = dirname( dirname( __FILE__ ) ) . '/namespaced/' . str_replace( '\\', '/', $relative_class ) . '.php'; |
|
| 42 | 42 | // if the file exists, require it |
| 43 | - if (file_exists($file)) { |
|
| 43 | + if ( file_exists( $file ) ) { |
|
| 44 | 44 | require_once $file; |
| 45 | 45 | return true; |
| 46 | 46 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!is_callable('sodium_crypto_stream_xchacha20')) { |
|
| 3 | +if ( ! is_callable( 'sodium_crypto_stream_xchacha20' ) ) { |
|
| 4 | 4 | /** |
| 5 | 5 | * @see ParagonIE_Sodium_Compat::crypto_stream_xchacha20() |
| 6 | 6 | * @param int $len |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | * @throws SodiumException |
| 11 | 11 | * @throws TypeError |
| 12 | 12 | */ |
| 13 | - function sodium_crypto_stream_xchacha20($len, $nonce, $key) |
|
| 13 | + function sodium_crypto_stream_xchacha20( $len, $nonce, $key ) |
|
| 14 | 14 | { |
| 15 | - return ParagonIE_Sodium_Compat::crypto_stream_xchacha20($len, $nonce, $key, true); |
|
| 15 | + return ParagonIE_Sodium_Compat::crypto_stream_xchacha20( $len, $nonce, $key, true ); |
|
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | -if (!is_callable('sodium_crypto_stream_xchacha20_keygen')) { |
|
| 18 | +if ( ! is_callable( 'sodium_crypto_stream_xchacha20_keygen' ) ) { |
|
| 19 | 19 | /** |
| 20 | 20 | * @see ParagonIE_Sodium_Compat::crypto_stream_xchacha20_keygen() |
| 21 | 21 | * @return string |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_keygen(); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | -if (!is_callable('sodium_crypto_stream_xchacha20_xor')) { |
|
| 29 | +if ( ! is_callable( 'sodium_crypto_stream_xchacha20_xor' ) ) { |
|
| 30 | 30 | /** |
| 31 | 31 | * @see ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor() |
| 32 | 32 | * @param string $message |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | * @throws SodiumException |
| 37 | 37 | * @throws TypeError |
| 38 | 38 | */ |
| 39 | - function sodium_crypto_stream_xchacha20_xor($message, $nonce, $key) |
|
| 39 | + function sodium_crypto_stream_xchacha20_xor( $message, $nonce, $key ) |
|
| 40 | 40 | { |
| 41 | - return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor($message, $nonce, $key, true); |
|
| 41 | + return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor( $message, $nonce, $key, true ); |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once dirname(dirname(__FILE__)) . '/autoload.php'; |
|
| 3 | +require_once dirname( dirname( __FILE__ ) ) . '/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * This file will monkey patch the pure-PHP implementation in place of the |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * Thus, the functions or constants just proxy to the appropriate |
| 10 | 10 | * ParagonIE_Sodium_Compat method or class constant, respectively. |
| 11 | 11 | */ |
| 12 | -foreach (array( |
|
| 12 | +foreach ( array( |
|
| 13 | 13 | 'BASE64_VARIANT_ORIGINAL', |
| 14 | 14 | 'BASE64_VARIANT_ORIGINAL_NO_PADDING', |
| 15 | 15 | 'BASE64_VARIANT_URLSAFE', |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | 'VERSION_STRING' |
| 104 | 104 | ) as $constant |
| 105 | 105 | ) { |
| 106 | - if (!defined("SODIUM_$constant") && defined("ParagonIE_Sodium_Compat::$constant")) { |
|
| 107 | - define("SODIUM_$constant", constant("ParagonIE_Sodium_Compat::$constant")); |
|
| 106 | + if ( ! defined( "SODIUM_$constant" ) && defined( "ParagonIE_Sodium_Compat::$constant" ) ) { |
|
| 107 | + define( "SODIUM_$constant", constant( "ParagonIE_Sodium_Compat::$constant" ) ); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | -if (!is_callable('sodium_add')) { |
|
| 110 | +if ( ! is_callable( 'sodium_add' ) ) { |
|
| 111 | 111 | /** |
| 112 | 112 | * @see ParagonIE_Sodium_Compat::add() |
| 113 | 113 | * @param string $val |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | * @return void |
| 116 | 116 | * @throws SodiumException |
| 117 | 117 | */ |
| 118 | - function sodium_add(&$val, $addv) |
|
| 118 | + function sodium_add( &$val, $addv ) |
|
| 119 | 119 | { |
| 120 | - ParagonIE_Sodium_Compat::add($val, $addv); |
|
| 120 | + ParagonIE_Sodium_Compat::add( $val, $addv ); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | -if (!is_callable('sodium_base642bin')) { |
|
| 123 | +if ( ! is_callable( 'sodium_base642bin' ) ) { |
|
| 124 | 124 | /** |
| 125 | 125 | * @see ParagonIE_Sodium_Compat::bin2base64() |
| 126 | 126 | * @param string $string |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | * @throws SodiumException |
| 131 | 131 | * @throws TypeError |
| 132 | 132 | */ |
| 133 | - function sodium_base642bin($string, $variant, $ignore ='') |
|
| 133 | + function sodium_base642bin( $string, $variant, $ignore = '' ) |
|
| 134 | 134 | { |
| 135 | - return ParagonIE_Sodium_Compat::base642bin($string, $variant, $ignore); |
|
| 135 | + return ParagonIE_Sodium_Compat::base642bin( $string, $variant, $ignore ); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | -if (!is_callable('sodium_bin2base64')) { |
|
| 138 | +if ( ! is_callable( 'sodium_bin2base64' ) ) { |
|
| 139 | 139 | /** |
| 140 | 140 | * @see ParagonIE_Sodium_Compat::bin2base64() |
| 141 | 141 | * @param string $string |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | * @throws SodiumException |
| 145 | 145 | * @throws TypeError |
| 146 | 146 | */ |
| 147 | - function sodium_bin2base64($string, $variant) |
|
| 147 | + function sodium_bin2base64( $string, $variant ) |
|
| 148 | 148 | { |
| 149 | - return ParagonIE_Sodium_Compat::bin2base64($string, $variant); |
|
| 149 | + return ParagonIE_Sodium_Compat::bin2base64( $string, $variant ); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | -if (!is_callable('sodium_bin2hex')) { |
|
| 152 | +if ( ! is_callable( 'sodium_bin2hex' ) ) { |
|
| 153 | 153 | /** |
| 154 | 154 | * @see ParagonIE_Sodium_Compat::hex2bin() |
| 155 | 155 | * @param string $string |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | * @throws SodiumException |
| 158 | 158 | * @throws TypeError |
| 159 | 159 | */ |
| 160 | - function sodium_bin2hex($string) |
|
| 160 | + function sodium_bin2hex( $string ) |
|
| 161 | 161 | { |
| 162 | - return ParagonIE_Sodium_Compat::bin2hex($string); |
|
| 162 | + return ParagonIE_Sodium_Compat::bin2hex( $string ); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | -if (!is_callable('sodium_compare')) { |
|
| 165 | +if ( ! is_callable( 'sodium_compare' ) ) { |
|
| 166 | 166 | /** |
| 167 | 167 | * @see ParagonIE_Sodium_Compat::compare() |
| 168 | 168 | * @param string $a |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | * @throws SodiumException |
| 172 | 172 | * @throws TypeError |
| 173 | 173 | */ |
| 174 | - function sodium_compare($a, $b) |
|
| 174 | + function sodium_compare( $a, $b ) |
|
| 175 | 175 | { |
| 176 | - return ParagonIE_Sodium_Compat::compare($a, $b); |
|
| 176 | + return ParagonIE_Sodium_Compat::compare( $a, $b ); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | -if (!is_callable('sodium_crypto_aead_aes256gcm_decrypt')) { |
|
| 179 | +if ( ! is_callable( 'sodium_crypto_aead_aes256gcm_decrypt' ) ) { |
|
| 180 | 180 | /** |
| 181 | 181 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt() |
| 182 | 182 | * @param string $message |
@@ -185,18 +185,18 @@ discard block |
||
| 185 | 185 | * @param string $key |
| 186 | 186 | * @return string|bool |
| 187 | 187 | */ |
| 188 | - function sodium_crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) |
|
| 188 | + function sodium_crypto_aead_aes256gcm_decrypt( $message, $assocData, $nonce, $key ) |
|
| 189 | 189 | { |
| 190 | 190 | try { |
| 191 | - return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key); |
|
| 192 | - } catch (Error $ex) { |
|
| 191 | + return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt( $message, $assocData, $nonce, $key ); |
|
| 192 | + } catch ( Error $ex ) { |
|
| 193 | 193 | return false; |
| 194 | - } catch (Exception $ex) { |
|
| 194 | + } catch ( Exception $ex ) { |
|
| 195 | 195 | return false; |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | -if (!is_callable('sodium_crypto_aead_aes256gcm_encrypt')) { |
|
| 199 | +if ( ! is_callable( 'sodium_crypto_aead_aes256gcm_encrypt' ) ) { |
|
| 200 | 200 | /** |
| 201 | 201 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt() |
| 202 | 202 | * @param string $message |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | * @throws SodiumException |
| 208 | 208 | * @throws TypeError |
| 209 | 209 | */ |
| 210 | - function sodium_crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) |
|
| 210 | + function sodium_crypto_aead_aes256gcm_encrypt( $message, $assocData, $nonce, $key ) |
|
| 211 | 211 | { |
| 212 | - return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key); |
|
| 212 | + return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt( $message, $assocData, $nonce, $key ); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | -if (!is_callable('sodium_crypto_aead_aes256gcm_is_available')) { |
|
| 215 | +if ( ! is_callable( 'sodium_crypto_aead_aes256gcm_is_available' ) ) { |
|
| 216 | 216 | /** |
| 217 | 217 | * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available() |
| 218 | 218 | * @return bool |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available(); |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_decrypt')) { |
|
| 225 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_decrypt' ) ) { |
|
| 226 | 226 | /** |
| 227 | 227 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt() |
| 228 | 228 | * @param string $message |
@@ -231,18 +231,18 @@ discard block |
||
| 231 | 231 | * @param string $key |
| 232 | 232 | * @return string|bool |
| 233 | 233 | */ |
| 234 | - function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) |
|
| 234 | + function sodium_crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ) |
|
| 235 | 235 | { |
| 236 | 236 | try { |
| 237 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); |
|
| 238 | - } catch (Error $ex) { |
|
| 237 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt( $message, $assocData, $nonce, $key ); |
|
| 238 | + } catch ( Error $ex ) { |
|
| 239 | 239 | return false; |
| 240 | - } catch (Exception $ex) { |
|
| 240 | + } catch ( Exception $ex ) { |
|
| 241 | 241 | return false; |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_encrypt')) { |
|
| 245 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_encrypt' ) ) { |
|
| 246 | 246 | /** |
| 247 | 247 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt() |
| 248 | 248 | * @param string $message |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | * @throws SodiumException |
| 254 | 254 | * @throws TypeError |
| 255 | 255 | */ |
| 256 | - function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) |
|
| 256 | + function sodium_crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ) |
|
| 257 | 257 | { |
| 258 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); |
|
| 258 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt( $message, $assocData, $nonce, $key ); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_keygen')) { |
|
| 261 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_keygen' ) ) { |
|
| 262 | 262 | /** |
| 263 | 263 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen() |
| 264 | 264 | * @return string |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen(); |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_decrypt')) { |
|
| 272 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' ) ) { |
|
| 273 | 273 | /** |
| 274 | 274 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt() |
| 275 | 275 | * @param string $message |
@@ -278,18 +278,18 @@ discard block |
||
| 278 | 278 | * @param string $key |
| 279 | 279 | * @return string|bool |
| 280 | 280 | */ |
| 281 | - function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
| 281 | + function sodium_crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ) |
|
| 282 | 282 | { |
| 283 | 283 | try { |
| 284 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); |
|
| 285 | - } catch (Error $ex) { |
|
| 284 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ); |
|
| 285 | + } catch ( Error $ex ) { |
|
| 286 | 286 | return false; |
| 287 | - } catch (Exception $ex) { |
|
| 287 | + } catch ( Exception $ex ) { |
|
| 288 | 288 | return false; |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_encrypt')) { |
|
| 292 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_ietf_encrypt' ) ) { |
|
| 293 | 293 | /** |
| 294 | 294 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt() |
| 295 | 295 | * @param string $message |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | * @throws SodiumException |
| 301 | 301 | * @throws TypeError |
| 302 | 302 | */ |
| 303 | - function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
| 303 | + function sodium_crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ) |
|
| 304 | 304 | { |
| 305 | - return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); |
|
| 305 | + return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | -if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_keygen')) { |
|
| 308 | +if ( ! is_callable( 'sodium_crypto_aead_chacha20poly1305_ietf_keygen' ) ) { |
|
| 309 | 309 | /** |
| 310 | 310 | * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen() |
| 311 | 311 | * @return string |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen(); |
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | -if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt')) { |
|
| 319 | +if ( ! is_callable( 'sodium_crypto_aead_xchacha20poly1305_ietf_decrypt' ) ) { |
|
| 320 | 320 | /** |
| 321 | 321 | * @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt() |
| 322 | 322 | * @param string $message |
@@ -325,18 +325,18 @@ discard block |
||
| 325 | 325 | * @param string $key |
| 326 | 326 | * @return string|bool |
| 327 | 327 | */ |
| 328 | - function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) |
|
| 328 | + function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key ) |
|
| 329 | 329 | { |
| 330 | 330 | try { |
| 331 | - return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key, true); |
|
| 332 | - } catch (Error $ex) { |
|
| 331 | + return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt( $message, $assocData, $nonce, $key, true ); |
|
| 332 | + } catch ( Error $ex ) { |
|
| 333 | 333 | return false; |
| 334 | - } catch (Exception $ex) { |
|
| 334 | + } catch ( Exception $ex ) { |
|
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | -if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')) { |
|
| 339 | +if ( ! is_callable( 'sodium_crypto_aead_xchacha20poly1305_ietf_encrypt' ) ) { |
|
| 340 | 340 | /** |
| 341 | 341 | * @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt() |
| 342 | 342 | * @param string $message |
@@ -347,12 +347,12 @@ discard block |
||
| 347 | 347 | * @throws SodiumException |
| 348 | 348 | * @throws TypeError |
| 349 | 349 | */ |
| 350 | - function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) |
|
| 350 | + function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key ) |
|
| 351 | 351 | { |
| 352 | - return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key, true); |
|
| 352 | + return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt( $message, $assocData, $nonce, $key, true ); |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | -if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_keygen')) { |
|
| 355 | +if ( ! is_callable( 'sodium_crypto_aead_xchacha20poly1305_ietf_keygen' ) ) { |
|
| 356 | 356 | /** |
| 357 | 357 | * @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen() |
| 358 | 358 | * @return string |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen(); |
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | -if (!is_callable('sodium_crypto_auth')) { |
|
| 366 | +if ( ! is_callable( 'sodium_crypto_auth' ) ) { |
|
| 367 | 367 | /** |
| 368 | 368 | * @see ParagonIE_Sodium_Compat::crypto_auth() |
| 369 | 369 | * @param string $message |
@@ -372,12 +372,12 @@ discard block |
||
| 372 | 372 | * @throws SodiumException |
| 373 | 373 | * @throws TypeError |
| 374 | 374 | */ |
| 375 | - function sodium_crypto_auth($message, $key) |
|
| 375 | + function sodium_crypto_auth( $message, $key ) |
|
| 376 | 376 | { |
| 377 | - return ParagonIE_Sodium_Compat::crypto_auth($message, $key); |
|
| 377 | + return ParagonIE_Sodium_Compat::crypto_auth( $message, $key ); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | -if (!is_callable('sodium_crypto_auth_keygen')) { |
|
| 380 | +if ( ! is_callable( 'sodium_crypto_auth_keygen' ) ) { |
|
| 381 | 381 | /** |
| 382 | 382 | * @see ParagonIE_Sodium_Compat::crypto_auth_keygen() |
| 383 | 383 | * @return string |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return ParagonIE_Sodium_Compat::crypto_auth_keygen(); |
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | -if (!is_callable('sodium_crypto_auth_verify')) { |
|
| 391 | +if ( ! is_callable( 'sodium_crypto_auth_verify' ) ) { |
|
| 392 | 392 | /** |
| 393 | 393 | * @see ParagonIE_Sodium_Compat::crypto_auth_verify() |
| 394 | 394 | * @param string $mac |
@@ -398,12 +398,12 @@ discard block |
||
| 398 | 398 | * @throws SodiumException |
| 399 | 399 | * @throws TypeError |
| 400 | 400 | */ |
| 401 | - function sodium_crypto_auth_verify($mac, $message, $key) |
|
| 401 | + function sodium_crypto_auth_verify( $mac, $message, $key ) |
|
| 402 | 402 | { |
| 403 | - return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); |
|
| 403 | + return ParagonIE_Sodium_Compat::crypto_auth_verify( $mac, $message, $key ); |
|
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | -if (!is_callable('sodium_crypto_box')) { |
|
| 406 | +if ( ! is_callable( 'sodium_crypto_box' ) ) { |
|
| 407 | 407 | /** |
| 408 | 408 | * @see ParagonIE_Sodium_Compat::crypto_box() |
| 409 | 409 | * @param string $message |
@@ -413,12 +413,12 @@ discard block |
||
| 413 | 413 | * @throws SodiumException |
| 414 | 414 | * @throws TypeError |
| 415 | 415 | */ |
| 416 | - function sodium_crypto_box($message, $nonce, $kp) |
|
| 416 | + function sodium_crypto_box( $message, $nonce, $kp ) |
|
| 417 | 417 | { |
| 418 | - return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); |
|
| 418 | + return ParagonIE_Sodium_Compat::crypto_box( $message, $nonce, $kp ); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | -if (!is_callable('sodium_crypto_box_keypair')) { |
|
| 421 | +if ( ! is_callable( 'sodium_crypto_box_keypair' ) ) { |
|
| 422 | 422 | /** |
| 423 | 423 | * @see ParagonIE_Sodium_Compat::crypto_box_keypair() |
| 424 | 424 | * @return string |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | return ParagonIE_Sodium_Compat::crypto_box_keypair(); |
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | -if (!is_callable('sodium_crypto_box_keypair_from_secretkey_and_publickey')) { |
|
| 433 | +if ( ! is_callable( 'sodium_crypto_box_keypair_from_secretkey_and_publickey' ) ) { |
|
| 434 | 434 | /** |
| 435 | 435 | * @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey() |
| 436 | 436 | * @param string $sk |
@@ -439,12 +439,12 @@ discard block |
||
| 439 | 439 | * @throws SodiumException |
| 440 | 440 | * @throws TypeError |
| 441 | 441 | */ |
| 442 | - function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) |
|
| 442 | + function sodium_crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ) |
|
| 443 | 443 | { |
| 444 | - return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); |
|
| 444 | + return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey( $sk, $pk ); |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | -if (!is_callable('sodium_crypto_box_open')) { |
|
| 447 | +if ( ! is_callable( 'sodium_crypto_box_open' ) ) { |
|
| 448 | 448 | /** |
| 449 | 449 | * @see ParagonIE_Sodium_Compat::crypto_box_open() |
| 450 | 450 | * @param string $message |
@@ -452,18 +452,18 @@ discard block |
||
| 452 | 452 | * @param string $kp |
| 453 | 453 | * @return string|bool |
| 454 | 454 | */ |
| 455 | - function sodium_crypto_box_open($message, $nonce, $kp) |
|
| 455 | + function sodium_crypto_box_open( $message, $nonce, $kp ) |
|
| 456 | 456 | { |
| 457 | 457 | try { |
| 458 | - return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); |
|
| 459 | - } catch (Error $ex) { |
|
| 458 | + return ParagonIE_Sodium_Compat::crypto_box_open( $message, $nonce, $kp ); |
|
| 459 | + } catch ( Error $ex ) { |
|
| 460 | 460 | return false; |
| 461 | - } catch (Exception $ex) { |
|
| 461 | + } catch ( Exception $ex ) { |
|
| 462 | 462 | return false; |
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | -if (!is_callable('sodium_crypto_box_publickey')) { |
|
| 466 | +if ( ! is_callable( 'sodium_crypto_box_publickey' ) ) { |
|
| 467 | 467 | /** |
| 468 | 468 | * @see ParagonIE_Sodium_Compat::crypto_box_publickey() |
| 469 | 469 | * @param string $keypair |
@@ -471,12 +471,12 @@ discard block |
||
| 471 | 471 | * @throws SodiumException |
| 472 | 472 | * @throws TypeError |
| 473 | 473 | */ |
| 474 | - function sodium_crypto_box_publickey($keypair) |
|
| 474 | + function sodium_crypto_box_publickey( $keypair ) |
|
| 475 | 475 | { |
| 476 | - return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); |
|
| 476 | + return ParagonIE_Sodium_Compat::crypto_box_publickey( $keypair ); |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | -if (!is_callable('sodium_crypto_box_publickey_from_secretkey')) { |
|
| 479 | +if ( ! is_callable( 'sodium_crypto_box_publickey_from_secretkey' ) ) { |
|
| 480 | 480 | /** |
| 481 | 481 | * @see ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey() |
| 482 | 482 | * @param string $sk |
@@ -484,12 +484,12 @@ discard block |
||
| 484 | 484 | * @throws SodiumException |
| 485 | 485 | * @throws TypeError |
| 486 | 486 | */ |
| 487 | - function sodium_crypto_box_publickey_from_secretkey($sk) |
|
| 487 | + function sodium_crypto_box_publickey_from_secretkey( $sk ) |
|
| 488 | 488 | { |
| 489 | - return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); |
|
| 489 | + return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey( $sk ); |
|
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | -if (!is_callable('sodium_crypto_box_seal')) { |
|
| 492 | +if ( ! is_callable( 'sodium_crypto_box_seal' ) ) { |
|
| 493 | 493 | /** |
| 494 | 494 | * @see ParagonIE_Sodium_Compat::crypto_box_seal() |
| 495 | 495 | * @param string $message |
@@ -498,12 +498,12 @@ discard block |
||
| 498 | 498 | * @throws SodiumException |
| 499 | 499 | * @throws TypeError |
| 500 | 500 | */ |
| 501 | - function sodium_crypto_box_seal($message, $publicKey) |
|
| 501 | + function sodium_crypto_box_seal( $message, $publicKey ) |
|
| 502 | 502 | { |
| 503 | - return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); |
|
| 503 | + return ParagonIE_Sodium_Compat::crypto_box_seal( $message, $publicKey ); |
|
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | -if (!is_callable('sodium_crypto_box_seal_open')) { |
|
| 506 | +if ( ! is_callable( 'sodium_crypto_box_seal_open' ) ) { |
|
| 507 | 507 | /** |
| 508 | 508 | * @see ParagonIE_Sodium_Compat::crypto_box_seal_open() |
| 509 | 509 | * @param string $message |
@@ -511,19 +511,19 @@ discard block |
||
| 511 | 511 | * @return string|bool |
| 512 | 512 | * @throws SodiumException |
| 513 | 513 | */ |
| 514 | - function sodium_crypto_box_seal_open($message, $kp) |
|
| 514 | + function sodium_crypto_box_seal_open( $message, $kp ) |
|
| 515 | 515 | { |
| 516 | 516 | try { |
| 517 | - return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); |
|
| 518 | - } catch (SodiumException $ex) { |
|
| 519 | - if ($ex->getMessage() === 'Argument 2 must be CRYPTO_BOX_KEYPAIRBYTES long.') { |
|
| 517 | + return ParagonIE_Sodium_Compat::crypto_box_seal_open( $message, $kp ); |
|
| 518 | + } catch ( SodiumException $ex ) { |
|
| 519 | + if ( $ex->getMessage() === 'Argument 2 must be CRYPTO_BOX_KEYPAIRBYTES long.' ) { |
|
| 520 | 520 | throw $ex; |
| 521 | 521 | } |
| 522 | 522 | return false; |
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | -if (!is_callable('sodium_crypto_box_secretkey')) { |
|
| 526 | +if ( ! is_callable( 'sodium_crypto_box_secretkey' ) ) { |
|
| 527 | 527 | /** |
| 528 | 528 | * @see ParagonIE_Sodium_Compat::crypto_box_secretkey() |
| 529 | 529 | * @param string $keypair |
@@ -531,12 +531,12 @@ discard block |
||
| 531 | 531 | * @throws SodiumException |
| 532 | 532 | * @throws TypeError |
| 533 | 533 | */ |
| 534 | - function sodium_crypto_box_secretkey($keypair) |
|
| 534 | + function sodium_crypto_box_secretkey( $keypair ) |
|
| 535 | 535 | { |
| 536 | - return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); |
|
| 536 | + return ParagonIE_Sodium_Compat::crypto_box_secretkey( $keypair ); |
|
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | -if (!is_callable('sodium_crypto_box_seed_keypair')) { |
|
| 539 | +if ( ! is_callable( 'sodium_crypto_box_seed_keypair' ) ) { |
|
| 540 | 540 | /** |
| 541 | 541 | * @see ParagonIE_Sodium_Compat::crypto_box_seed_keypair() |
| 542 | 542 | * @param string $seed |
@@ -544,12 +544,12 @@ discard block |
||
| 544 | 544 | * @throws SodiumException |
| 545 | 545 | * @throws TypeError |
| 546 | 546 | */ |
| 547 | - function sodium_crypto_box_seed_keypair($seed) |
|
| 547 | + function sodium_crypto_box_seed_keypair( $seed ) |
|
| 548 | 548 | { |
| 549 | - return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); |
|
| 549 | + return ParagonIE_Sodium_Compat::crypto_box_seed_keypair( $seed ); |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | -if (!is_callable('sodium_crypto_generichash')) { |
|
| 552 | +if ( ! is_callable( 'sodium_crypto_generichash' ) ) { |
|
| 553 | 553 | /** |
| 554 | 554 | * @see ParagonIE_Sodium_Compat::crypto_generichash() |
| 555 | 555 | * @param string $message |
@@ -559,12 +559,12 @@ discard block |
||
| 559 | 559 | * @throws SodiumException |
| 560 | 560 | * @throws TypeError |
| 561 | 561 | */ |
| 562 | - function sodium_crypto_generichash($message, $key = null, $outLen = 32) |
|
| 562 | + function sodium_crypto_generichash( $message, $key = null, $outLen = 32 ) |
|
| 563 | 563 | { |
| 564 | - return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); |
|
| 564 | + return ParagonIE_Sodium_Compat::crypto_generichash( $message, $key, $outLen ); |
|
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | -if (!is_callable('sodium_crypto_generichash_final')) { |
|
| 567 | +if ( ! is_callable( 'sodium_crypto_generichash_final' ) ) { |
|
| 568 | 568 | /** |
| 569 | 569 | * @see ParagonIE_Sodium_Compat::crypto_generichash_final() |
| 570 | 570 | * @param string|null $ctx |
@@ -573,12 +573,12 @@ discard block |
||
| 573 | 573 | * @throws SodiumException |
| 574 | 574 | * @throws TypeError |
| 575 | 575 | */ |
| 576 | - function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) |
|
| 576 | + function sodium_crypto_generichash_final( &$ctx, $outputLength = 32 ) |
|
| 577 | 577 | { |
| 578 | - return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); |
|
| 578 | + return ParagonIE_Sodium_Compat::crypto_generichash_final( $ctx, $outputLength ); |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | -if (!is_callable('sodium_crypto_generichash_init')) { |
|
| 581 | +if ( ! is_callable( 'sodium_crypto_generichash_init' ) ) { |
|
| 582 | 582 | /** |
| 583 | 583 | * @see ParagonIE_Sodium_Compat::crypto_generichash_init() |
| 584 | 584 | * @param string|null $key |
@@ -587,12 +587,12 @@ discard block |
||
| 587 | 587 | * @throws SodiumException |
| 588 | 588 | * @throws TypeError |
| 589 | 589 | */ |
| 590 | - function sodium_crypto_generichash_init($key = null, $outLen = 32) |
|
| 590 | + function sodium_crypto_generichash_init( $key = null, $outLen = 32 ) |
|
| 591 | 591 | { |
| 592 | - return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); |
|
| 592 | + return ParagonIE_Sodium_Compat::crypto_generichash_init( $key, $outLen ); |
|
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | -if (!is_callable('sodium_crypto_generichash_keygen')) { |
|
| 595 | +if ( ! is_callable( 'sodium_crypto_generichash_keygen' ) ) { |
|
| 596 | 596 | /** |
| 597 | 597 | * @see ParagonIE_Sodium_Compat::crypto_generichash_keygen() |
| 598 | 598 | * @return string |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | return ParagonIE_Sodium_Compat::crypto_generichash_keygen(); |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | -if (!is_callable('sodium_crypto_generichash_update')) { |
|
| 606 | +if ( ! is_callable( 'sodium_crypto_generichash_update' ) ) { |
|
| 607 | 607 | /** |
| 608 | 608 | * @see ParagonIE_Sodium_Compat::crypto_generichash_update() |
| 609 | 609 | * @param string|null $ctx |
@@ -612,12 +612,12 @@ discard block |
||
| 612 | 612 | * @throws SodiumException |
| 613 | 613 | * @throws TypeError |
| 614 | 614 | */ |
| 615 | - function sodium_crypto_generichash_update(&$ctx, $message = '') |
|
| 615 | + function sodium_crypto_generichash_update( &$ctx, $message = '' ) |
|
| 616 | 616 | { |
| 617 | - ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); |
|
| 617 | + ParagonIE_Sodium_Compat::crypto_generichash_update( $ctx, $message ); |
|
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | -if (!is_callable('sodium_crypto_kdf_keygen')) { |
|
| 620 | +if ( ! is_callable( 'sodium_crypto_kdf_keygen' ) ) { |
|
| 621 | 621 | /** |
| 622 | 622 | * @see ParagonIE_Sodium_Compat::crypto_kdf_keygen() |
| 623 | 623 | * @return string |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | return ParagonIE_Sodium_Compat::crypto_kdf_keygen(); |
| 629 | 629 | } |
| 630 | 630 | } |
| 631 | -if (!is_callable('sodium_crypto_kdf_derive_from_key')) { |
|
| 631 | +if ( ! is_callable( 'sodium_crypto_kdf_derive_from_key' ) ) { |
|
| 632 | 632 | /** |
| 633 | 633 | * @see ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key() |
| 634 | 634 | * @param int $subkey_len |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | * @return string |
| 639 | 639 | * @throws Exception |
| 640 | 640 | */ |
| 641 | - function sodium_crypto_kdf_derive_from_key($subkey_len, $subkey_id, $context, $key) |
|
| 641 | + function sodium_crypto_kdf_derive_from_key( $subkey_len, $subkey_id, $context, $key ) |
|
| 642 | 642 | { |
| 643 | 643 | return ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key( |
| 644 | 644 | $subkey_len, |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | ); |
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | -if (!is_callable('sodium_crypto_kx')) { |
|
| 651 | +if ( ! is_callable( 'sodium_crypto_kx' ) ) { |
|
| 652 | 652 | /** |
| 653 | 653 | * @see ParagonIE_Sodium_Compat::crypto_kx() |
| 654 | 654 | * @param string $my_secret |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | * @throws SodiumException |
| 660 | 660 | * @throws TypeError |
| 661 | 661 | */ |
| 662 | - function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) |
|
| 662 | + function sodium_crypto_kx( $my_secret, $their_public, $client_public, $server_public ) |
|
| 663 | 663 | { |
| 664 | 664 | return ParagonIE_Sodium_Compat::crypto_kx( |
| 665 | 665 | $my_secret, |
@@ -669,18 +669,18 @@ discard block |
||
| 669 | 669 | ); |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | -if (!is_callable('sodium_crypto_kx_seed_keypair')) { |
|
| 672 | +if ( ! is_callable( 'sodium_crypto_kx_seed_keypair' ) ) { |
|
| 673 | 673 | /** |
| 674 | 674 | * @param string $seed |
| 675 | 675 | * @return string |
| 676 | 676 | * @throws Exception |
| 677 | 677 | */ |
| 678 | - function sodium_crypto_kx_seed_keypair($seed) |
|
| 678 | + function sodium_crypto_kx_seed_keypair( $seed ) |
|
| 679 | 679 | { |
| 680 | - return ParagonIE_Sodium_Compat::crypto_kx_seed_keypair($seed); |
|
| 680 | + return ParagonIE_Sodium_Compat::crypto_kx_seed_keypair( $seed ); |
|
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | -if (!is_callable('sodium_crypto_kx_keypair')) { |
|
| 683 | +if ( ! is_callable( 'sodium_crypto_kx_keypair' ) ) { |
|
| 684 | 684 | /** |
| 685 | 685 | * @return string |
| 686 | 686 | * @throws Exception |
@@ -690,53 +690,53 @@ discard block |
||
| 690 | 690 | return ParagonIE_Sodium_Compat::crypto_kx_keypair(); |
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | -if (!is_callable('sodium_crypto_kx_client_session_keys')) { |
|
| 693 | +if ( ! is_callable( 'sodium_crypto_kx_client_session_keys' ) ) { |
|
| 694 | 694 | /** |
| 695 | 695 | * @param string $keypair |
| 696 | 696 | * @param string $serverPublicKey |
| 697 | 697 | * @return array{0: string, 1: string} |
| 698 | 698 | * @throws SodiumException |
| 699 | 699 | */ |
| 700 | - function sodium_crypto_kx_client_session_keys($keypair, $serverPublicKey) |
|
| 700 | + function sodium_crypto_kx_client_session_keys( $keypair, $serverPublicKey ) |
|
| 701 | 701 | { |
| 702 | - return ParagonIE_Sodium_Compat::crypto_kx_client_session_keys($keypair, $serverPublicKey); |
|
| 702 | + return ParagonIE_Sodium_Compat::crypto_kx_client_session_keys( $keypair, $serverPublicKey ); |
|
| 703 | 703 | } |
| 704 | 704 | } |
| 705 | -if (!is_callable('sodium_crypto_kx_server_session_keys')) { |
|
| 705 | +if ( ! is_callable( 'sodium_crypto_kx_server_session_keys' ) ) { |
|
| 706 | 706 | /** |
| 707 | 707 | * @param string $keypair |
| 708 | 708 | * @param string $clientPublicKey |
| 709 | 709 | * @return array{0: string, 1: string} |
| 710 | 710 | * @throws SodiumException |
| 711 | 711 | */ |
| 712 | - function sodium_crypto_kx_server_session_keys($keypair, $clientPublicKey) |
|
| 712 | + function sodium_crypto_kx_server_session_keys( $keypair, $clientPublicKey ) |
|
| 713 | 713 | { |
| 714 | - return ParagonIE_Sodium_Compat::crypto_kx_server_session_keys($keypair, $clientPublicKey); |
|
| 714 | + return ParagonIE_Sodium_Compat::crypto_kx_server_session_keys( $keypair, $clientPublicKey ); |
|
| 715 | 715 | } |
| 716 | 716 | } |
| 717 | -if (!is_callable('sodium_crypto_kx_secretkey')) { |
|
| 717 | +if ( ! is_callable( 'sodium_crypto_kx_secretkey' ) ) { |
|
| 718 | 718 | /** |
| 719 | 719 | * @param string $keypair |
| 720 | 720 | * @return string |
| 721 | 721 | * @throws Exception |
| 722 | 722 | */ |
| 723 | - function sodium_crypto_kx_secretkey($keypair) |
|
| 723 | + function sodium_crypto_kx_secretkey( $keypair ) |
|
| 724 | 724 | { |
| 725 | - return ParagonIE_Sodium_Compat::crypto_kx_secretkey($keypair); |
|
| 725 | + return ParagonIE_Sodium_Compat::crypto_kx_secretkey( $keypair ); |
|
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | -if (!is_callable('sodium_crypto_kx_publickey')) { |
|
| 728 | +if ( ! is_callable( 'sodium_crypto_kx_publickey' ) ) { |
|
| 729 | 729 | /** |
| 730 | 730 | * @param string $keypair |
| 731 | 731 | * @return string |
| 732 | 732 | * @throws Exception |
| 733 | 733 | */ |
| 734 | - function sodium_crypto_kx_publickey($keypair) |
|
| 734 | + function sodium_crypto_kx_publickey( $keypair ) |
|
| 735 | 735 | { |
| 736 | - return ParagonIE_Sodium_Compat::crypto_kx_publickey($keypair); |
|
| 736 | + return ParagonIE_Sodium_Compat::crypto_kx_publickey( $keypair ); |
|
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | -if (!is_callable('sodium_crypto_pwhash')) { |
|
| 739 | +if ( ! is_callable( 'sodium_crypto_pwhash' ) ) { |
|
| 740 | 740 | /** |
| 741 | 741 | * @see ParagonIE_Sodium_Compat::crypto_pwhash() |
| 742 | 742 | * @param int $outlen |
@@ -749,12 +749,12 @@ discard block |
||
| 749 | 749 | * @throws SodiumException |
| 750 | 750 | * @throws TypeError |
| 751 | 751 | */ |
| 752 | - function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $algo = null) |
|
| 752 | + function sodium_crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit, $algo = null ) |
|
| 753 | 753 | { |
| 754 | - return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $algo); |
|
| 754 | + return ParagonIE_Sodium_Compat::crypto_pwhash( $outlen, $passwd, $salt, $opslimit, $memlimit, $algo ); |
|
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | -if (!is_callable('sodium_crypto_pwhash_str')) { |
|
| 757 | +if ( ! is_callable( 'sodium_crypto_pwhash_str' ) ) { |
|
| 758 | 758 | /** |
| 759 | 759 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_str() |
| 760 | 760 | * @param string $passwd |
@@ -764,12 +764,12 @@ discard block |
||
| 764 | 764 | * @throws SodiumException |
| 765 | 765 | * @throws TypeError |
| 766 | 766 | */ |
| 767 | - function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) |
|
| 767 | + function sodium_crypto_pwhash_str( $passwd, $opslimit, $memlimit ) |
|
| 768 | 768 | { |
| 769 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); |
|
| 769 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str( $passwd, $opslimit, $memlimit ); |
|
| 770 | 770 | } |
| 771 | 771 | } |
| 772 | -if (!is_callable('sodium_crypto_pwhash_str_needs_rehash')) { |
|
| 772 | +if ( ! is_callable( 'sodium_crypto_pwhash_str_needs_rehash' ) ) { |
|
| 773 | 773 | /** |
| 774 | 774 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash() |
| 775 | 775 | * @param string $hash |
@@ -779,12 +779,12 @@ discard block |
||
| 779 | 779 | * |
| 780 | 780 | * @throws SodiumException |
| 781 | 781 | */ |
| 782 | - function sodium_crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit) |
|
| 782 | + function sodium_crypto_pwhash_str_needs_rehash( $hash, $opslimit, $memlimit ) |
|
| 783 | 783 | { |
| 784 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit); |
|
| 784 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash( $hash, $opslimit, $memlimit ); |
|
| 785 | 785 | } |
| 786 | 786 | } |
| 787 | -if (!is_callable('sodium_crypto_pwhash_str_verify')) { |
|
| 787 | +if ( ! is_callable( 'sodium_crypto_pwhash_str_verify' ) ) { |
|
| 788 | 788 | /** |
| 789 | 789 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_str_verify() |
| 790 | 790 | * @param string $passwd |
@@ -793,12 +793,12 @@ discard block |
||
| 793 | 793 | * @throws SodiumException |
| 794 | 794 | * @throws TypeError |
| 795 | 795 | */ |
| 796 | - function sodium_crypto_pwhash_str_verify($passwd, $hash) |
|
| 796 | + function sodium_crypto_pwhash_str_verify( $passwd, $hash ) |
|
| 797 | 797 | { |
| 798 | - return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); |
|
| 798 | + return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify( $passwd, $hash ); |
|
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | -if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256')) { |
|
| 801 | +if ( ! is_callable( 'sodium_crypto_pwhash_scryptsalsa208sha256' ) ) { |
|
| 802 | 802 | /** |
| 803 | 803 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256() |
| 804 | 804 | * @param int $outlen |
@@ -810,12 +810,12 @@ discard block |
||
| 810 | 810 | * @throws SodiumException |
| 811 | 811 | * @throws TypeError |
| 812 | 812 | */ |
| 813 | - function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) |
|
| 813 | + function sodium_crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ) |
|
| 814 | 814 | { |
| 815 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); |
|
| 815 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256( $outlen, $passwd, $salt, $opslimit, $memlimit ); |
|
| 816 | 816 | } |
| 817 | 817 | } |
| 818 | -if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str')) { |
|
| 818 | +if ( ! is_callable( 'sodium_crypto_pwhash_scryptsalsa208sha256_str' ) ) { |
|
| 819 | 819 | /** |
| 820 | 820 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str() |
| 821 | 821 | * @param string $passwd |
@@ -825,12 +825,12 @@ discard block |
||
| 825 | 825 | * @throws SodiumException |
| 826 | 826 | * @throws TypeError |
| 827 | 827 | */ |
| 828 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) |
|
| 828 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ) |
|
| 829 | 829 | { |
| 830 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); |
|
| 830 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str( $passwd, $opslimit, $memlimit ); |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | -if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str_verify')) { |
|
| 833 | +if ( ! is_callable( 'sodium_crypto_pwhash_scryptsalsa208sha256_str_verify' ) ) { |
|
| 834 | 834 | /** |
| 835 | 835 | * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify() |
| 836 | 836 | * @param string $passwd |
@@ -839,12 +839,12 @@ discard block |
||
| 839 | 839 | * @throws SodiumException |
| 840 | 840 | * @throws TypeError |
| 841 | 841 | */ |
| 842 | - function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) |
|
| 842 | + function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ) |
|
| 843 | 843 | { |
| 844 | - return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); |
|
| 844 | + return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify( $passwd, $hash ); |
|
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | -if (!is_callable('sodium_crypto_scalarmult')) { |
|
| 847 | +if ( ! is_callable( 'sodium_crypto_scalarmult' ) ) { |
|
| 848 | 848 | /** |
| 849 | 849 | * @see ParagonIE_Sodium_Compat::crypto_scalarmult() |
| 850 | 850 | * @param string $n |
@@ -853,12 +853,12 @@ discard block |
||
| 853 | 853 | * @throws SodiumException |
| 854 | 854 | * @throws TypeError |
| 855 | 855 | */ |
| 856 | - function sodium_crypto_scalarmult($n, $p) |
|
| 856 | + function sodium_crypto_scalarmult( $n, $p ) |
|
| 857 | 857 | { |
| 858 | - return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); |
|
| 858 | + return ParagonIE_Sodium_Compat::crypto_scalarmult( $n, $p ); |
|
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | -if (!is_callable('sodium_crypto_scalarmult_base')) { |
|
| 861 | +if ( ! is_callable( 'sodium_crypto_scalarmult_base' ) ) { |
|
| 862 | 862 | /** |
| 863 | 863 | * @see ParagonIE_Sodium_Compat::crypto_scalarmult_base() |
| 864 | 864 | * @param string $n |
@@ -866,12 +866,12 @@ discard block |
||
| 866 | 866 | * @throws SodiumException |
| 867 | 867 | * @throws TypeError |
| 868 | 868 | */ |
| 869 | - function sodium_crypto_scalarmult_base($n) |
|
| 869 | + function sodium_crypto_scalarmult_base( $n ) |
|
| 870 | 870 | { |
| 871 | - return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); |
|
| 871 | + return ParagonIE_Sodium_Compat::crypto_scalarmult_base( $n ); |
|
| 872 | 872 | } |
| 873 | 873 | } |
| 874 | -if (!is_callable('sodium_crypto_secretbox')) { |
|
| 874 | +if ( ! is_callable( 'sodium_crypto_secretbox' ) ) { |
|
| 875 | 875 | /** |
| 876 | 876 | * @see ParagonIE_Sodium_Compat::crypto_secretbox() |
| 877 | 877 | * @param string $message |
@@ -881,12 +881,12 @@ discard block |
||
| 881 | 881 | * @throws SodiumException |
| 882 | 882 | * @throws TypeError |
| 883 | 883 | */ |
| 884 | - function sodium_crypto_secretbox($message, $nonce, $key) |
|
| 884 | + function sodium_crypto_secretbox( $message, $nonce, $key ) |
|
| 885 | 885 | { |
| 886 | - return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); |
|
| 886 | + return ParagonIE_Sodium_Compat::crypto_secretbox( $message, $nonce, $key ); |
|
| 887 | 887 | } |
| 888 | 888 | } |
| 889 | -if (!is_callable('sodium_crypto_secretbox_keygen')) { |
|
| 889 | +if ( ! is_callable( 'sodium_crypto_secretbox_keygen' ) ) { |
|
| 890 | 890 | /** |
| 891 | 891 | * @see ParagonIE_Sodium_Compat::crypto_secretbox_keygen() |
| 892 | 892 | * @return string |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | return ParagonIE_Sodium_Compat::crypto_secretbox_keygen(); |
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | -if (!is_callable('sodium_crypto_secretbox_open')) { |
|
| 900 | +if ( ! is_callable( 'sodium_crypto_secretbox_open' ) ) { |
|
| 901 | 901 | /** |
| 902 | 902 | * @see ParagonIE_Sodium_Compat::crypto_secretbox_open() |
| 903 | 903 | * @param string $message |
@@ -905,29 +905,29 @@ discard block |
||
| 905 | 905 | * @param string $key |
| 906 | 906 | * @return string|bool |
| 907 | 907 | */ |
| 908 | - function sodium_crypto_secretbox_open($message, $nonce, $key) |
|
| 908 | + function sodium_crypto_secretbox_open( $message, $nonce, $key ) |
|
| 909 | 909 | { |
| 910 | 910 | try { |
| 911 | - return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); |
|
| 912 | - } catch (Error $ex) { |
|
| 911 | + return ParagonIE_Sodium_Compat::crypto_secretbox_open( $message, $nonce, $key ); |
|
| 912 | + } catch ( Error $ex ) { |
|
| 913 | 913 | return false; |
| 914 | - } catch (Exception $ex) { |
|
| 914 | + } catch ( Exception $ex ) { |
|
| 915 | 915 | return false; |
| 916 | 916 | } |
| 917 | 917 | } |
| 918 | 918 | } |
| 919 | -if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_push')) { |
|
| 919 | +if ( ! is_callable( 'sodium_crypto_secretstream_xchacha20poly1305_init_push' ) ) { |
|
| 920 | 920 | /** |
| 921 | 921 | * @param string $key |
| 922 | 922 | * @return array<int, string> |
| 923 | 923 | * @throws SodiumException |
| 924 | 924 | */ |
| 925 | - function sodium_crypto_secretstream_xchacha20poly1305_init_push($key) |
|
| 925 | + function sodium_crypto_secretstream_xchacha20poly1305_init_push( $key ) |
|
| 926 | 926 | { |
| 927 | - return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_push($key); |
|
| 927 | + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_push( $key ); |
|
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | -if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_push')) { |
|
| 930 | +if ( ! is_callable( 'sodium_crypto_secretstream_xchacha20poly1305_push' ) ) { |
|
| 931 | 931 | /** |
| 932 | 932 | * @param string $state |
| 933 | 933 | * @param string $msg |
@@ -936,24 +936,24 @@ discard block |
||
| 936 | 936 | * @return string |
| 937 | 937 | * @throws SodiumException |
| 938 | 938 | */ |
| 939 | - function sodium_crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) |
|
| 939 | + function sodium_crypto_secretstream_xchacha20poly1305_push( &$state, $msg, $aad = '', $tag = 0 ) |
|
| 940 | 940 | { |
| 941 | - return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_push($state, $msg, $aad, $tag); |
|
| 941 | + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_push( $state, $msg, $aad, $tag ); |
|
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | -if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_pull')) { |
|
| 944 | +if ( ! is_callable( 'sodium_crypto_secretstream_xchacha20poly1305_init_pull' ) ) { |
|
| 945 | 945 | /** |
| 946 | 946 | * @param string $header |
| 947 | 947 | * @param string $key |
| 948 | 948 | * @return string |
| 949 | 949 | * @throws Exception |
| 950 | 950 | */ |
| 951 | - function sodium_crypto_secretstream_xchacha20poly1305_init_pull($header, $key) |
|
| 951 | + function sodium_crypto_secretstream_xchacha20poly1305_init_pull( $header, $key ) |
|
| 952 | 952 | { |
| 953 | - return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull($header, $key); |
|
| 953 | + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull( $header, $key ); |
|
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | -if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_pull')) { |
|
| 956 | +if ( ! is_callable( 'sodium_crypto_secretstream_xchacha20poly1305_pull' ) ) { |
|
| 957 | 957 | /** |
| 958 | 958 | * @param string $state |
| 959 | 959 | * @param string $cipher |
@@ -961,23 +961,23 @@ discard block |
||
| 961 | 961 | * @return bool|array{0: string, 1: int} |
| 962 | 962 | * @throws SodiumException |
| 963 | 963 | */ |
| 964 | - function sodium_crypto_secretstream_xchacha20poly1305_pull(&$state, $cipher, $aad = '') |
|
| 964 | + function sodium_crypto_secretstream_xchacha20poly1305_pull( &$state, $cipher, $aad = '' ) |
|
| 965 | 965 | { |
| 966 | - return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull($state, $cipher, $aad); |
|
| 966 | + return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull( $state, $cipher, $aad ); |
|
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | -if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_rekey')) { |
|
| 969 | +if ( ! is_callable( 'sodium_crypto_secretstream_xchacha20poly1305_rekey' ) ) { |
|
| 970 | 970 | /** |
| 971 | 971 | * @param string $state |
| 972 | 972 | * @return void |
| 973 | 973 | * @throws SodiumException |
| 974 | 974 | */ |
| 975 | - function sodium_crypto_secretstream_xchacha20poly1305_rekey(&$state) |
|
| 975 | + function sodium_crypto_secretstream_xchacha20poly1305_rekey( &$state ) |
|
| 976 | 976 | { |
| 977 | - ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey($state); |
|
| 977 | + ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey( $state ); |
|
| 978 | 978 | } |
| 979 | 979 | } |
| 980 | -if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_keygen')) { |
|
| 980 | +if ( ! is_callable( 'sodium_crypto_secretstream_xchacha20poly1305_keygen' ) ) { |
|
| 981 | 981 | /** |
| 982 | 982 | * @return string |
| 983 | 983 | * @throws Exception |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_keygen(); |
| 988 | 988 | } |
| 989 | 989 | } |
| 990 | -if (!is_callable('sodium_crypto_shorthash')) { |
|
| 990 | +if ( ! is_callable( 'sodium_crypto_shorthash' ) ) { |
|
| 991 | 991 | /** |
| 992 | 992 | * @see ParagonIE_Sodium_Compat::crypto_shorthash() |
| 993 | 993 | * @param string $message |
@@ -996,12 +996,12 @@ discard block |
||
| 996 | 996 | * @throws SodiumException |
| 997 | 997 | * @throws TypeError |
| 998 | 998 | */ |
| 999 | - function sodium_crypto_shorthash($message, $key = '') |
|
| 999 | + function sodium_crypto_shorthash( $message, $key = '' ) |
|
| 1000 | 1000 | { |
| 1001 | - return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); |
|
| 1001 | + return ParagonIE_Sodium_Compat::crypto_shorthash( $message, $key ); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | -if (!is_callable('sodium_crypto_shorthash_keygen')) { |
|
| 1004 | +if ( ! is_callable( 'sodium_crypto_shorthash_keygen' ) ) { |
|
| 1005 | 1005 | /** |
| 1006 | 1006 | * @see ParagonIE_Sodium_Compat::crypto_shorthash_keygen() |
| 1007 | 1007 | * @return string |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | return ParagonIE_Sodium_Compat::crypto_shorthash_keygen(); |
| 1013 | 1013 | } |
| 1014 | 1014 | } |
| 1015 | -if (!is_callable('sodium_crypto_sign')) { |
|
| 1015 | +if ( ! is_callable( 'sodium_crypto_sign' ) ) { |
|
| 1016 | 1016 | /** |
| 1017 | 1017 | * @see ParagonIE_Sodium_Compat::crypto_sign() |
| 1018 | 1018 | * @param string $message |
@@ -1021,12 +1021,12 @@ discard block |
||
| 1021 | 1021 | * @throws SodiumException |
| 1022 | 1022 | * @throws TypeError |
| 1023 | 1023 | */ |
| 1024 | - function sodium_crypto_sign($message, $sk) |
|
| 1024 | + function sodium_crypto_sign( $message, $sk ) |
|
| 1025 | 1025 | { |
| 1026 | - return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); |
|
| 1026 | + return ParagonIE_Sodium_Compat::crypto_sign( $message, $sk ); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | } |
| 1029 | -if (!is_callable('sodium_crypto_sign_detached')) { |
|
| 1029 | +if ( ! is_callable( 'sodium_crypto_sign_detached' ) ) { |
|
| 1030 | 1030 | /** |
| 1031 | 1031 | * @see ParagonIE_Sodium_Compat::crypto_sign_detached() |
| 1032 | 1032 | * @param string $message |
@@ -1035,12 +1035,12 @@ discard block |
||
| 1035 | 1035 | * @throws SodiumException |
| 1036 | 1036 | * @throws TypeError |
| 1037 | 1037 | */ |
| 1038 | - function sodium_crypto_sign_detached($message, $sk) |
|
| 1038 | + function sodium_crypto_sign_detached( $message, $sk ) |
|
| 1039 | 1039 | { |
| 1040 | - return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); |
|
| 1040 | + return ParagonIE_Sodium_Compat::crypto_sign_detached( $message, $sk ); |
|
| 1041 | 1041 | } |
| 1042 | 1042 | } |
| 1043 | -if (!is_callable('sodium_crypto_sign_keypair_from_secretkey_and_publickey')) { |
|
| 1043 | +if ( ! is_callable( 'sodium_crypto_sign_keypair_from_secretkey_and_publickey' ) ) { |
|
| 1044 | 1044 | /** |
| 1045 | 1045 | * @see ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey() |
| 1046 | 1046 | * @param string $sk |
@@ -1049,12 +1049,12 @@ discard block |
||
| 1049 | 1049 | * @throws SodiumException |
| 1050 | 1050 | * @throws TypeError |
| 1051 | 1051 | */ |
| 1052 | - function sodium_crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk) |
|
| 1052 | + function sodium_crypto_sign_keypair_from_secretkey_and_publickey( $sk, $pk ) |
|
| 1053 | 1053 | { |
| 1054 | - return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk); |
|
| 1054 | + return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey( $sk, $pk ); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | -if (!is_callable('sodium_crypto_sign_keypair')) { |
|
| 1057 | +if ( ! is_callable( 'sodium_crypto_sign_keypair' ) ) { |
|
| 1058 | 1058 | /** |
| 1059 | 1059 | * @see ParagonIE_Sodium_Compat::crypto_sign_keypair() |
| 1060 | 1060 | * @return string |
@@ -1066,25 +1066,25 @@ discard block |
||
| 1066 | 1066 | return ParagonIE_Sodium_Compat::crypto_sign_keypair(); |
| 1067 | 1067 | } |
| 1068 | 1068 | } |
| 1069 | -if (!is_callable('sodium_crypto_sign_open')) { |
|
| 1069 | +if ( ! is_callable( 'sodium_crypto_sign_open' ) ) { |
|
| 1070 | 1070 | /** |
| 1071 | 1071 | * @see ParagonIE_Sodium_Compat::crypto_sign_open() |
| 1072 | 1072 | * @param string $signedMessage |
| 1073 | 1073 | * @param string $pk |
| 1074 | 1074 | * @return string|bool |
| 1075 | 1075 | */ |
| 1076 | - function sodium_crypto_sign_open($signedMessage, $pk) |
|
| 1076 | + function sodium_crypto_sign_open( $signedMessage, $pk ) |
|
| 1077 | 1077 | { |
| 1078 | 1078 | try { |
| 1079 | - return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); |
|
| 1080 | - } catch (Error $ex) { |
|
| 1079 | + return ParagonIE_Sodium_Compat::crypto_sign_open( $signedMessage, $pk ); |
|
| 1080 | + } catch ( Error $ex ) { |
|
| 1081 | 1081 | return false; |
| 1082 | - } catch (Exception $ex) { |
|
| 1082 | + } catch ( Exception $ex ) { |
|
| 1083 | 1083 | return false; |
| 1084 | 1084 | } |
| 1085 | 1085 | } |
| 1086 | 1086 | } |
| 1087 | -if (!is_callable('sodium_crypto_sign_publickey')) { |
|
| 1087 | +if ( ! is_callable( 'sodium_crypto_sign_publickey' ) ) { |
|
| 1088 | 1088 | /** |
| 1089 | 1089 | * @see ParagonIE_Sodium_Compat::crypto_sign_publickey() |
| 1090 | 1090 | * @param string $keypair |
@@ -1092,12 +1092,12 @@ discard block |
||
| 1092 | 1092 | * @throws SodiumException |
| 1093 | 1093 | * @throws TypeError |
| 1094 | 1094 | */ |
| 1095 | - function sodium_crypto_sign_publickey($keypair) |
|
| 1095 | + function sodium_crypto_sign_publickey( $keypair ) |
|
| 1096 | 1096 | { |
| 1097 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); |
|
| 1097 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey( $keypair ); |
|
| 1098 | 1098 | } |
| 1099 | 1099 | } |
| 1100 | -if (!is_callable('sodium_crypto_sign_publickey_from_secretkey')) { |
|
| 1100 | +if ( ! is_callable( 'sodium_crypto_sign_publickey_from_secretkey' ) ) { |
|
| 1101 | 1101 | /** |
| 1102 | 1102 | * @see ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey() |
| 1103 | 1103 | * @param string $sk |
@@ -1105,12 +1105,12 @@ discard block |
||
| 1105 | 1105 | * @throws SodiumException |
| 1106 | 1106 | * @throws TypeError |
| 1107 | 1107 | */ |
| 1108 | - function sodium_crypto_sign_publickey_from_secretkey($sk) |
|
| 1108 | + function sodium_crypto_sign_publickey_from_secretkey( $sk ) |
|
| 1109 | 1109 | { |
| 1110 | - return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); |
|
| 1110 | + return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey( $sk ); |
|
| 1111 | 1111 | } |
| 1112 | 1112 | } |
| 1113 | -if (!is_callable('sodium_crypto_sign_secretkey')) { |
|
| 1113 | +if ( ! is_callable( 'sodium_crypto_sign_secretkey' ) ) { |
|
| 1114 | 1114 | /** |
| 1115 | 1115 | * @see ParagonIE_Sodium_Compat::crypto_sign_secretkey() |
| 1116 | 1116 | * @param string $keypair |
@@ -1118,12 +1118,12 @@ discard block |
||
| 1118 | 1118 | * @throws SodiumException |
| 1119 | 1119 | * @throws TypeError |
| 1120 | 1120 | */ |
| 1121 | - function sodium_crypto_sign_secretkey($keypair) |
|
| 1121 | + function sodium_crypto_sign_secretkey( $keypair ) |
|
| 1122 | 1122 | { |
| 1123 | - return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); |
|
| 1123 | + return ParagonIE_Sodium_Compat::crypto_sign_secretkey( $keypair ); |
|
| 1124 | 1124 | } |
| 1125 | 1125 | } |
| 1126 | -if (!is_callable('sodium_crypto_sign_seed_keypair')) { |
|
| 1126 | +if ( ! is_callable( 'sodium_crypto_sign_seed_keypair' ) ) { |
|
| 1127 | 1127 | /** |
| 1128 | 1128 | * @see ParagonIE_Sodium_Compat::crypto_sign_seed_keypair() |
| 1129 | 1129 | * @param string $seed |
@@ -1131,12 +1131,12 @@ discard block |
||
| 1131 | 1131 | * @throws SodiumException |
| 1132 | 1132 | * @throws TypeError |
| 1133 | 1133 | */ |
| 1134 | - function sodium_crypto_sign_seed_keypair($seed) |
|
| 1134 | + function sodium_crypto_sign_seed_keypair( $seed ) |
|
| 1135 | 1135 | { |
| 1136 | - return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); |
|
| 1136 | + return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair( $seed ); |
|
| 1137 | 1137 | } |
| 1138 | 1138 | } |
| 1139 | -if (!is_callable('sodium_crypto_sign_verify_detached')) { |
|
| 1139 | +if ( ! is_callable( 'sodium_crypto_sign_verify_detached' ) ) { |
|
| 1140 | 1140 | /** |
| 1141 | 1141 | * @see ParagonIE_Sodium_Compat::crypto_sign_verify_detached() |
| 1142 | 1142 | * @param string $signature |
@@ -1146,12 +1146,12 @@ discard block |
||
| 1146 | 1146 | * @throws SodiumException |
| 1147 | 1147 | * @throws TypeError |
| 1148 | 1148 | */ |
| 1149 | - function sodium_crypto_sign_verify_detached($signature, $message, $pk) |
|
| 1149 | + function sodium_crypto_sign_verify_detached( $signature, $message, $pk ) |
|
| 1150 | 1150 | { |
| 1151 | - return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); |
|
| 1151 | + return ParagonIE_Sodium_Compat::crypto_sign_verify_detached( $signature, $message, $pk ); |
|
| 1152 | 1152 | } |
| 1153 | 1153 | } |
| 1154 | -if (!is_callable('sodium_crypto_sign_ed25519_pk_to_curve25519')) { |
|
| 1154 | +if ( ! is_callable( 'sodium_crypto_sign_ed25519_pk_to_curve25519' ) ) { |
|
| 1155 | 1155 | /** |
| 1156 | 1156 | * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519() |
| 1157 | 1157 | * @param string $pk |
@@ -1159,12 +1159,12 @@ discard block |
||
| 1159 | 1159 | * @throws SodiumException |
| 1160 | 1160 | * @throws TypeError |
| 1161 | 1161 | */ |
| 1162 | - function sodium_crypto_sign_ed25519_pk_to_curve25519($pk) |
|
| 1162 | + function sodium_crypto_sign_ed25519_pk_to_curve25519( $pk ) |
|
| 1163 | 1163 | { |
| 1164 | - return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($pk); |
|
| 1164 | + return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519( $pk ); |
|
| 1165 | 1165 | } |
| 1166 | 1166 | } |
| 1167 | -if (!is_callable('sodium_crypto_sign_ed25519_sk_to_curve25519')) { |
|
| 1167 | +if ( ! is_callable( 'sodium_crypto_sign_ed25519_sk_to_curve25519' ) ) { |
|
| 1168 | 1168 | /** |
| 1169 | 1169 | * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519() |
| 1170 | 1170 | * @param string $sk |
@@ -1172,12 +1172,12 @@ discard block |
||
| 1172 | 1172 | * @throws SodiumException |
| 1173 | 1173 | * @throws TypeError |
| 1174 | 1174 | */ |
| 1175 | - function sodium_crypto_sign_ed25519_sk_to_curve25519($sk) |
|
| 1175 | + function sodium_crypto_sign_ed25519_sk_to_curve25519( $sk ) |
|
| 1176 | 1176 | { |
| 1177 | - return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); |
|
| 1177 | + return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519( $sk ); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | } |
| 1180 | -if (!is_callable('sodium_crypto_stream')) { |
|
| 1180 | +if ( ! is_callable( 'sodium_crypto_stream' ) ) { |
|
| 1181 | 1181 | /** |
| 1182 | 1182 | * @see ParagonIE_Sodium_Compat::crypto_stream() |
| 1183 | 1183 | * @param int $len |
@@ -1187,12 +1187,12 @@ discard block |
||
| 1187 | 1187 | * @throws SodiumException |
| 1188 | 1188 | * @throws TypeError |
| 1189 | 1189 | */ |
| 1190 | - function sodium_crypto_stream($len, $nonce, $key) |
|
| 1190 | + function sodium_crypto_stream( $len, $nonce, $key ) |
|
| 1191 | 1191 | { |
| 1192 | - return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); |
|
| 1192 | + return ParagonIE_Sodium_Compat::crypto_stream( $len, $nonce, $key ); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | -if (!is_callable('sodium_crypto_stream_keygen')) { |
|
| 1195 | +if ( ! is_callable( 'sodium_crypto_stream_keygen' ) ) { |
|
| 1196 | 1196 | /** |
| 1197 | 1197 | * @see ParagonIE_Sodium_Compat::crypto_stream_keygen() |
| 1198 | 1198 | * @return string |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | return ParagonIE_Sodium_Compat::crypto_stream_keygen(); |
| 1204 | 1204 | } |
| 1205 | 1205 | } |
| 1206 | -if (!is_callable('sodium_crypto_stream_xor')) { |
|
| 1206 | +if ( ! is_callable( 'sodium_crypto_stream_xor' ) ) { |
|
| 1207 | 1207 | /** |
| 1208 | 1208 | * @see ParagonIE_Sodium_Compat::crypto_stream_xor() |
| 1209 | 1209 | * @param string $message |
@@ -1213,13 +1213,13 @@ discard block |
||
| 1213 | 1213 | * @throws SodiumException |
| 1214 | 1214 | * @throws TypeError |
| 1215 | 1215 | */ |
| 1216 | - function sodium_crypto_stream_xor($message, $nonce, $key) |
|
| 1216 | + function sodium_crypto_stream_xor( $message, $nonce, $key ) |
|
| 1217 | 1217 | { |
| 1218 | - return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); |
|
| 1218 | + return ParagonIE_Sodium_Compat::crypto_stream_xor( $message, $nonce, $key ); |
|
| 1219 | 1219 | } |
| 1220 | 1220 | } |
| 1221 | -require_once dirname(__FILE__) . '/stream-xchacha20.php'; |
|
| 1222 | -if (!is_callable('sodium_hex2bin')) { |
|
| 1221 | +require_once dirname( __FILE__ ) . '/stream-xchacha20.php'; |
|
| 1222 | +if ( ! is_callable( 'sodium_hex2bin' ) ) { |
|
| 1223 | 1223 | /** |
| 1224 | 1224 | * @see ParagonIE_Sodium_Compat::hex2bin() |
| 1225 | 1225 | * @param string $string |
@@ -1227,12 +1227,12 @@ discard block |
||
| 1227 | 1227 | * @throws SodiumException |
| 1228 | 1228 | * @throws TypeError |
| 1229 | 1229 | */ |
| 1230 | - function sodium_hex2bin($string) |
|
| 1230 | + function sodium_hex2bin( $string ) |
|
| 1231 | 1231 | { |
| 1232 | - return ParagonIE_Sodium_Compat::hex2bin($string); |
|
| 1232 | + return ParagonIE_Sodium_Compat::hex2bin( $string ); |
|
| 1233 | 1233 | } |
| 1234 | 1234 | } |
| 1235 | -if (!is_callable('sodium_increment')) { |
|
| 1235 | +if ( ! is_callable( 'sodium_increment' ) ) { |
|
| 1236 | 1236 | /** |
| 1237 | 1237 | * @see ParagonIE_Sodium_Compat::increment() |
| 1238 | 1238 | * @param string $string |
@@ -1240,12 +1240,12 @@ discard block |
||
| 1240 | 1240 | * @throws SodiumException |
| 1241 | 1241 | * @throws TypeError |
| 1242 | 1242 | */ |
| 1243 | - function sodium_increment(&$string) |
|
| 1243 | + function sodium_increment( &$string ) |
|
| 1244 | 1244 | { |
| 1245 | - ParagonIE_Sodium_Compat::increment($string); |
|
| 1245 | + ParagonIE_Sodium_Compat::increment( $string ); |
|
| 1246 | 1246 | } |
| 1247 | 1247 | } |
| 1248 | -if (!is_callable('sodium_library_version_major')) { |
|
| 1248 | +if ( ! is_callable( 'sodium_library_version_major' ) ) { |
|
| 1249 | 1249 | /** |
| 1250 | 1250 | * @see ParagonIE_Sodium_Compat::library_version_major() |
| 1251 | 1251 | * @return int |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | return ParagonIE_Sodium_Compat::library_version_major(); |
| 1256 | 1256 | } |
| 1257 | 1257 | } |
| 1258 | -if (!is_callable('sodium_library_version_minor')) { |
|
| 1258 | +if ( ! is_callable( 'sodium_library_version_minor' ) ) { |
|
| 1259 | 1259 | /** |
| 1260 | 1260 | * @see ParagonIE_Sodium_Compat::library_version_minor() |
| 1261 | 1261 | * @return int |
@@ -1265,7 +1265,7 @@ discard block |
||
| 1265 | 1265 | return ParagonIE_Sodium_Compat::library_version_minor(); |
| 1266 | 1266 | } |
| 1267 | 1267 | } |
| 1268 | -if (!is_callable('sodium_version_string')) { |
|
| 1268 | +if ( ! is_callable( 'sodium_version_string' ) ) { |
|
| 1269 | 1269 | /** |
| 1270 | 1270 | * @see ParagonIE_Sodium_Compat::version_string() |
| 1271 | 1271 | * @return string |
@@ -1275,7 +1275,7 @@ discard block |
||
| 1275 | 1275 | return ParagonIE_Sodium_Compat::version_string(); |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | -if (!is_callable('sodium_memcmp')) { |
|
| 1278 | +if ( ! is_callable( 'sodium_memcmp' ) ) { |
|
| 1279 | 1279 | /** |
| 1280 | 1280 | * @see ParagonIE_Sodium_Compat::memcmp() |
| 1281 | 1281 | * @param string $a |
@@ -1284,12 +1284,12 @@ discard block |
||
| 1284 | 1284 | * @throws SodiumException |
| 1285 | 1285 | * @throws TypeError |
| 1286 | 1286 | */ |
| 1287 | - function sodium_memcmp($a, $b) |
|
| 1287 | + function sodium_memcmp( $a, $b ) |
|
| 1288 | 1288 | { |
| 1289 | - return ParagonIE_Sodium_Compat::memcmp($a, $b); |
|
| 1289 | + return ParagonIE_Sodium_Compat::memcmp( $a, $b ); |
|
| 1290 | 1290 | } |
| 1291 | 1291 | } |
| 1292 | -if (!is_callable('sodium_memzero')) { |
|
| 1292 | +if ( ! is_callable( 'sodium_memzero' ) ) { |
|
| 1293 | 1293 | /** |
| 1294 | 1294 | * @see ParagonIE_Sodium_Compat::memzero() |
| 1295 | 1295 | * @param string $str |
@@ -1297,12 +1297,12 @@ discard block |
||
| 1297 | 1297 | * @throws SodiumException |
| 1298 | 1298 | * @throws TypeError |
| 1299 | 1299 | */ |
| 1300 | - function sodium_memzero(&$str) |
|
| 1300 | + function sodium_memzero( &$str ) |
|
| 1301 | 1301 | { |
| 1302 | - ParagonIE_Sodium_Compat::memzero($str); |
|
| 1302 | + ParagonIE_Sodium_Compat::memzero( $str ); |
|
| 1303 | 1303 | } |
| 1304 | 1304 | } |
| 1305 | -if (!is_callable('sodium_pad')) { |
|
| 1305 | +if ( ! is_callable( 'sodium_pad' ) ) { |
|
| 1306 | 1306 | /** |
| 1307 | 1307 | * @see ParagonIE_Sodium_Compat::pad() |
| 1308 | 1308 | * @param string $unpadded |
@@ -1311,12 +1311,12 @@ discard block |
||
| 1311 | 1311 | * @throws SodiumException |
| 1312 | 1312 | * @throws TypeError |
| 1313 | 1313 | */ |
| 1314 | - function sodium_pad($unpadded, $blockSize) |
|
| 1314 | + function sodium_pad( $unpadded, $blockSize ) |
|
| 1315 | 1315 | { |
| 1316 | - return ParagonIE_Sodium_Compat::pad($unpadded, $blockSize, true); |
|
| 1316 | + return ParagonIE_Sodium_Compat::pad( $unpadded, $blockSize, true ); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | } |
| 1319 | -if (!is_callable('sodium_unpad')) { |
|
| 1319 | +if ( ! is_callable( 'sodium_unpad' ) ) { |
|
| 1320 | 1320 | /** |
| 1321 | 1321 | * @see ParagonIE_Sodium_Compat::pad() |
| 1322 | 1322 | * @param string $padded |
@@ -1325,38 +1325,38 @@ discard block |
||
| 1325 | 1325 | * @throws SodiumException |
| 1326 | 1326 | * @throws TypeError |
| 1327 | 1327 | */ |
| 1328 | - function sodium_unpad($padded, $blockSize) |
|
| 1328 | + function sodium_unpad( $padded, $blockSize ) |
|
| 1329 | 1329 | { |
| 1330 | - return ParagonIE_Sodium_Compat::unpad($padded, $blockSize, true); |
|
| 1330 | + return ParagonIE_Sodium_Compat::unpad( $padded, $blockSize, true ); |
|
| 1331 | 1331 | } |
| 1332 | 1332 | } |
| 1333 | -if (!is_callable('sodium_randombytes_buf')) { |
|
| 1333 | +if ( ! is_callable( 'sodium_randombytes_buf' ) ) { |
|
| 1334 | 1334 | /** |
| 1335 | 1335 | * @see ParagonIE_Sodium_Compat::randombytes_buf() |
| 1336 | 1336 | * @param int $amount |
| 1337 | 1337 | * @return string |
| 1338 | 1338 | * @throws Exception |
| 1339 | 1339 | */ |
| 1340 | - function sodium_randombytes_buf($amount) |
|
| 1340 | + function sodium_randombytes_buf( $amount ) |
|
| 1341 | 1341 | { |
| 1342 | - return ParagonIE_Sodium_Compat::randombytes_buf($amount); |
|
| 1342 | + return ParagonIE_Sodium_Compat::randombytes_buf( $amount ); |
|
| 1343 | 1343 | } |
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | -if (!is_callable('sodium_randombytes_uniform')) { |
|
| 1346 | +if ( ! is_callable( 'sodium_randombytes_uniform' ) ) { |
|
| 1347 | 1347 | /** |
| 1348 | 1348 | * @see ParagonIE_Sodium_Compat::randombytes_uniform() |
| 1349 | 1349 | * @param int $upperLimit |
| 1350 | 1350 | * @return int |
| 1351 | 1351 | * @throws Exception |
| 1352 | 1352 | */ |
| 1353 | - function sodium_randombytes_uniform($upperLimit) |
|
| 1353 | + function sodium_randombytes_uniform( $upperLimit ) |
|
| 1354 | 1354 | { |
| 1355 | - return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); |
|
| 1355 | + return ParagonIE_Sodium_Compat::randombytes_uniform( $upperLimit ); |
|
| 1356 | 1356 | } |
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | -if (!is_callable('sodium_randombytes_random16')) { |
|
| 1359 | +if ( ! is_callable( 'sodium_randombytes_random16' ) ) { |
|
| 1360 | 1360 | /** |
| 1361 | 1361 | * @see ParagonIE_Sodium_Compat::randombytes_random16() |
| 1362 | 1362 | * @return int |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | require_once 'autoload.php'; |
| 4 | -define('DO_PEDANTIC_TEST', true); |
|
| 4 | +define( 'DO_PEDANTIC_TEST', true ); |
|
| 5 | 5 | |
| 6 | 6 | ParagonIE_Sodium_Compat::$fastMult = true; |