Completed
Pull Request — develop (#1687)
by
unknown
16:12
created
vendor/paragonie/sodium_compat/src/Core/XSalsa20.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Class ParagonIE_Sodium_Core_XSalsa20
9 9
  */
10
-abstract class ParagonIE_Sodium_Core_XSalsa20 extends ParagonIE_Sodium_Core_HSalsa20
11
-{
10
+abstract class ParagonIE_Sodium_Core_XSalsa20 extends ParagonIE_Sodium_Core_HSalsa20 {
12 11
     /**
13 12
      * Expand a key and nonce into an xsalsa20 keystream.
14 13
      *
@@ -21,8 +20,7 @@  discard block
 block discarded – undo
21 20
      * @throws SodiumException
22 21
      * @throws TypeError
23 22
      */
24
-    public static function xsalsa20($len, $nonce, $key)
25
-    {
23
+    public static function xsalsa20($len, $nonce, $key) {
26 24
         $ret = self::salsa20(
27 25
             $len,
28 26
             self::substr($nonce, 16, 8),
@@ -43,8 +41,7 @@  discard block
 block discarded – undo
43 41
      * @throws SodiumException
44 42
      * @throws TypeError
45 43
      */
46
-    public static function xsalsa20_xor($message, $nonce, $key)
47
-    {
44
+    public static function xsalsa20_xor($message, $nonce, $key) {
48 45
         return self::xorStrings(
49 46
             $message,
50 47
             self::xsalsa20(
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/ChaCha20.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Class ParagonIE_Sodium_Core_ChaCha20
9 9
  */
10
-class ParagonIE_Sodium_Core_ChaCha20 extends ParagonIE_Sodium_Core_Util
11
-{
10
+class ParagonIE_Sodium_Core_ChaCha20 extends ParagonIE_Sodium_Core_Util {
12 11
     /**
13 12
      * Bitwise left rotation
14 13
      *
@@ -18,8 +17,7 @@  discard block
 block discarded – undo
18 17
      * @param int $n
19 18
      * @return int
20 19
      */
21
-    public static function rotate($v, $n)
22
-    {
20
+    public static function rotate($v, $n) {
23 21
         $v &= 0xffffffff;
24 22
         $n &= 31;
25 23
         return (int) (
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
      * @param int $d
43 41
      * @return array<int, int>
44 42
      */
45
-    protected static function quarterRound($a, $b, $c, $d)
46
-    {
43
+    protected static function quarterRound($a, $b, $c, $d) {
47 44
         # a = PLUS(a,b); d = ROTATE(XOR(d,a),16);
48 45
         /** @var int $a */
49 46
         $a = ($a + $b) & 0xffffffff;
@@ -329,8 +326,7 @@  discard block
 block discarded – undo
329 326
      * @throws SodiumException
330 327
      * @throws TypeError
331 328
      */
332
-    public static function stream($len = 64, $nonce = '', $key = '')
333
-    {
329
+    public static function stream($len = 64, $nonce = '', $key = '') {
334 330
         return self::encryptBytes(
335 331
             new ParagonIE_Sodium_Core_ChaCha20_Ctx($key, $nonce),
336 332
             str_repeat("\x00", $len)
@@ -347,8 +343,7 @@  discard block
 block discarded – undo
347 343
      * @throws SodiumException
348 344
      * @throws TypeError
349 345
      */
350
-    public static function ietfStream($len, $nonce = '', $key = '')
351
-    {
346
+    public static function ietfStream($len, $nonce = '', $key = '') {
352 347
         return self::encryptBytes(
353 348
             new ParagonIE_Sodium_Core_ChaCha20_IetfCtx($key, $nonce),
354 349
             str_repeat("\x00", $len)
@@ -366,8 +361,7 @@  discard block
 block discarded – undo
366 361
      * @throws SodiumException
367 362
      * @throws TypeError
368 363
      */
369
-    public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '')
370
-    {
364
+    public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '') {
371 365
         return self::encryptBytes(
372 366
             new ParagonIE_Sodium_Core_ChaCha20_IetfCtx($key, $nonce, $ic),
373 367
             $message
@@ -385,8 +379,7 @@  discard block
 block discarded – undo
385 379
      * @throws SodiumException
386 380
      * @throws TypeError
387 381
      */
388
-    public static function streamXorIc($message, $nonce = '', $key = '', $ic = '')
389
-    {
382
+    public static function streamXorIc($message, $nonce = '', $key = '', $ic = '') {
390 383
         return self::encryptBytes(
391 384
             new ParagonIE_Sodium_Core_ChaCha20_Ctx($key, $nonce, $ic),
392 385
             $message
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/HChaCha20.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Class ParagonIE_Sodium_Core_HChaCha20
9 9
  */
10
-class ParagonIE_Sodium_Core_HChaCha20 extends ParagonIE_Sodium_Core_ChaCha20
11
-{
10
+class ParagonIE_Sodium_Core_HChaCha20 extends ParagonIE_Sodium_Core_ChaCha20 {
12 11
     /**
13 12
      * @param string $in
14 13
      * @param string $key
@@ -16,8 +15,7 @@  discard block
 block discarded – undo
16 15
      * @return string
17 16
      * @throws TypeError
18 17
      */
19
-    public static function hChaCha20($in = '', $key = '', $c = null)
20
-    {
18
+    public static function hChaCha20($in = '', $key = '', $c = null) {
21 19
         $ctx = array();
22 20
 
23 21
         if ($c === null) {
@@ -51,8 +49,7 @@  discard block
 block discarded – undo
51 49
      * @return string
52 50
      * @throws TypeError
53 51
      */
54
-    protected static function hChaCha20Bytes(array $ctx)
55
-    {
52
+    protected static function hChaCha20Bytes(array $ctx) {
56 53
         $x0  = (int) $ctx[0];
57 54
         $x1  = (int) $ctx[1];
58 55
         $x2  = (int) $ctx[2];
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/HSalsa20.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Class ParagonIE_Sodium_Core_HSalsa20
9 9
  */
10
-abstract class ParagonIE_Sodium_Core_HSalsa20 extends ParagonIE_Sodium_Core_Salsa20
11
-{
10
+abstract class ParagonIE_Sodium_Core_HSalsa20 extends ParagonIE_Sodium_Core_Salsa20 {
12 11
     /**
13 12
      * Calculate an hsalsa20 hash of a single block
14 13
      *
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
      * @return string
24 23
      * @throws TypeError
25 24
      */
26
-    public static function hsalsa20($in, $k, $c = null)
27
-    {
25
+    public static function hsalsa20($in, $k, $c = null) {
28 26
         if ($c === null) {
29 27
             $x0  = 0x61707865;
30 28
             $x5  = 0x3320646e;
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Poly1305/State.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Class ParagonIE_Sodium_Core_Poly1305_State
9 9
  */
10
-class ParagonIE_Sodium_Core_Poly1305_State extends ParagonIE_Sodium_Core_Util
11
-{
10
+class ParagonIE_Sodium_Core_Poly1305_State extends ParagonIE_Sodium_Core_Util {
12 11
     /**
13 12
      * @var array<int, int>
14 13
      */
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      * @throws InvalidArgumentException
49 48
      * @throws TypeError
50 49
      */
51
-    public function __construct($key = '')
52
-    {
50
+    public function __construct($key = '') {
53 51
         if (self::strlen($key) < 32) {
54 52
             throw new InvalidArgumentException(
55 53
                 'Poly1305 requires a 32-byte key'
@@ -82,8 +80,7 @@  discard block
 block discarded – undo
82 80
     /**
83 81
      * Zero internal buffer upon destruction
84 82
      */
85
-    public function __destruct()
86
-    {
83
+    public function __destruct() {
87 84
         $this->r[0] ^= $this->r[0];
88 85
         $this->r[1] ^= $this->r[1];
89 86
         $this->r[2] ^= $this->r[2];
@@ -110,8 +107,7 @@  discard block
 block discarded – undo
110 107
      * @throws SodiumException
111 108
      * @throws TypeError
112 109
      */
113
-    public function update($message = '')
114
-    {
110
+    public function update($message = '') {
115 111
         $bytes = self::strlen($message);
116 112
         if ($bytes < 1) {
117 113
             return $this;
@@ -176,8 +172,7 @@  discard block
 block discarded – undo
176 172
      * @return self
177 173
      * @throws TypeError
178 174
      */
179
-    public function blocks($message, $bytes)
180
-    {
175
+    public function blocks($message, $bytes) {
181 176
         if (self::strlen($message) < 16) {
182 177
             $message = str_pad($message, 16, "\x00", STR_PAD_RIGHT);
183 178
         }
@@ -310,8 +305,7 @@  discard block
 block discarded – undo
310 305
      * @return string
311 306
      * @throws TypeError
312 307
      */
313
-    public function finish()
314
-    {
308
+    public function finish() {
315 309
         /* process the remaining block */
316 310
         if ($this->leftover) {
317 311
             $i = $this->leftover;
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Base64/Original.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
  *  Copyright (c) 2016 - 2018 Paragon Initiative Enterprises.
7 7
  *  Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com)
8 8
  */
9
-class ParagonIE_Sodium_Core_Base64_Original
10
-{
9
+class ParagonIE_Sodium_Core_Base64_Original {
11 10
     // COPY ParagonIE_Sodium_Core_Base64_Common STARTING HERE
12 11
     /**
13 12
      * Encode into Base64
@@ -18,8 +17,7 @@  discard block
 block discarded – undo
18 17
      * @return string
19 18
      * @throws TypeError
20 19
      */
21
-    public static function encode($src)
22
-    {
20
+    public static function encode($src) {
23 21
         return self::doEncode($src, true);
24 22
     }
25 23
 
@@ -32,8 +30,7 @@  discard block
 block discarded – undo
32 30
      * @return string
33 31
      * @throws TypeError
34 32
      */
35
-    public static function encodeUnpadded($src)
36
-    {
33
+    public static function encodeUnpadded($src) {
37 34
         return self::doEncode($src, false);
38 35
     }
39 36
 
@@ -43,8 +40,7 @@  discard block
 block discarded – undo
43 40
      * @return string
44 41
      * @throws TypeError
45 42
      */
46
-    protected static function doEncode($src, $pad = true)
47
-    {
43
+    protected static function doEncode($src, $pad = true) {
48 44
         $dest = '';
49 45
         $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
50 46
         // Main loop (no padding):
@@ -99,8 +95,7 @@  discard block
 block discarded – undo
99 95
      * @throws TypeError
100 96
      * @psalm-suppress RedundantCondition
101 97
      */
102
-    public static function decode($src, $strictPadding = false)
103
-    {
98
+    public static function decode($src, $strictPadding = false) {
104 99
         // Remove padding
105 100
         $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
106 101
         if ($srcLen === 0) {
@@ -198,8 +193,7 @@  discard block
 block discarded – undo
198 193
      * @param int $src
199 194
      * @return int
200 195
      */
201
-    protected static function decode6Bits($src)
202
-    {
196
+    protected static function decode6Bits($src) {
203 197
         $ret = -1;
204 198
 
205 199
         // if ($src > 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64
@@ -227,8 +221,7 @@  discard block
 block discarded – undo
227 221
      * @param int $src
228 222
      * @return string
229 223
      */
230
-    protected static function encode6Bits($src)
231
-    {
224
+    protected static function encode6Bits($src) {
232 225
         $diff = 0x41;
233 226
 
234 227
         // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Base64/Common.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@  discard block
 block discarded – undo
10 10
  * doesn't support late static binding, and we have no better workaround
11 11
  * available that won't break PHP 7+. Therefore, we're forced to duplicate code.
12 12
  */
13
-abstract class ParagonIE_Sodium_Core_Base64_Common
14
-{
13
+abstract class ParagonIE_Sodium_Core_Base64_Common {
15 14
     /**
16 15
      * Encode into Base64
17 16
      *
@@ -21,8 +20,7 @@  discard block
 block discarded – undo
21 20
      * @return string
22 21
      * @throws TypeError
23 22
      */
24
-    public static function encode($src)
25
-    {
23
+    public static function encode($src) {
26 24
         return self::doEncode($src, true);
27 25
     }
28 26
 
@@ -35,8 +33,7 @@  discard block
 block discarded – undo
35 33
      * @return string
36 34
      * @throws TypeError
37 35
      */
38
-    public static function encodeUnpadded($src)
39
-    {
36
+    public static function encodeUnpadded($src) {
40 37
         return self::doEncode($src, false);
41 38
     }
42 39
 
@@ -46,8 +43,7 @@  discard block
 block discarded – undo
46 43
      * @return string
47 44
      * @throws TypeError
48 45
      */
49
-    protected static function doEncode($src, $pad = true)
50
-    {
46
+    protected static function doEncode($src, $pad = true) {
51 47
         $dest = '';
52 48
         $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
53 49
         // Main loop (no padding):
@@ -102,8 +98,7 @@  discard block
 block discarded – undo
102 98
      * @throws TypeError
103 99
      * @psalm-suppress RedundantCondition
104 100
      */
105
-    public static function decode($src, $strictPadding = false)
106
-    {
101
+    public static function decode($src, $strictPadding = false) {
107 102
         // Remove padding
108 103
         $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
109 104
         if ($srcLen === 0) {
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Base64/UrlSafe.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
  *  Copyright (c) 2016 - 2018 Paragon Initiative Enterprises.
7 7
  *  Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com)
8 8
  */
9
-class ParagonIE_Sodium_Core_Base64_UrlSafe
10
-{
9
+class ParagonIE_Sodium_Core_Base64_UrlSafe {
11 10
     // COPY ParagonIE_Sodium_Core_Base64_Common STARTING HERE
12 11
     /**
13 12
      * Encode into Base64
@@ -18,8 +17,7 @@  discard block
 block discarded – undo
18 17
      * @return string
19 18
      * @throws TypeError
20 19
      */
21
-    public static function encode($src)
22
-    {
20
+    public static function encode($src) {
23 21
         return self::doEncode($src, true);
24 22
     }
25 23
 
@@ -32,8 +30,7 @@  discard block
 block discarded – undo
32 30
      * @return string
33 31
      * @throws TypeError
34 32
      */
35
-    public static function encodeUnpadded($src)
36
-    {
33
+    public static function encodeUnpadded($src) {
37 34
         return self::doEncode($src, false);
38 35
     }
39 36
 
@@ -43,8 +40,7 @@  discard block
 block discarded – undo
43 40
      * @return string
44 41
      * @throws TypeError
45 42
      */
46
-    protected static function doEncode($src, $pad = true)
47
-    {
43
+    protected static function doEncode($src, $pad = true) {
48 44
         $dest = '';
49 45
         $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
50 46
         // Main loop (no padding):
@@ -99,8 +95,7 @@  discard block
 block discarded – undo
99 95
      * @throws TypeError
100 96
      * @psalm-suppress RedundantCondition
101 97
      */
102
-    public static function decode($src, $strictPadding = false)
103
-    {
98
+    public static function decode($src, $strictPadding = false) {
104 99
         // Remove padding
105 100
         $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
106 101
         if ($srcLen === 0) {
@@ -197,8 +192,7 @@  discard block
 block discarded – undo
197 192
      * @param int $src
198 193
      * @return int
199 194
      */
200
-    protected static function decode6Bits($src)
201
-    {
195
+    protected static function decode6Bits($src) {
202 196
         $ret = -1;
203 197
 
204 198
         // if ($src > 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64
@@ -226,8 +220,7 @@  discard block
 block discarded – undo
226 220
      * @param int $src
227 221
      * @return string
228 222
      */
229
-    protected static function encode6Bits($src)
230
-    {
223
+    protected static function encode6Bits($src) {
231 224
         $diff = 0x41;
232 225
 
233 226
         // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/SecretStream/State.php 1 patch
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Class ParagonIE_Sodium_Core_SecretStream_State
5 5
  */
6
-class ParagonIE_Sodium_Core_SecretStream_State
7
-{
6
+class ParagonIE_Sodium_Core_SecretStream_State {
8 7
     /** @var string $key */
9 8
     protected $key;
10 9
 
@@ -22,8 +21,7 @@  discard block
 block discarded – undo
22 21
      * @param string $key
23 22
      * @param string|null $nonce
24 23
      */
25
-    public function __construct($key, $nonce = null)
26
-    {
24
+    public function __construct($key, $nonce = null) {
27 25
         $this->key = $key;
28 26
         $this->counter = 1;
29 27
         if (is_null($nonce)) {
@@ -36,8 +34,7 @@  discard block
 block discarded – undo
36 34
     /**
37 35
      * @return self
38 36
      */
39
-    public function counterReset()
40
-    {
37
+    public function counterReset() {
41 38
         $this->counter = 1;
42 39
         $this->_pad = str_repeat("\0", 4);
43 40
         return $this;
@@ -46,24 +43,21 @@  discard block
 block discarded – undo
46 43
     /**
47 44
      * @return string
48 45
      */
49
-    public function getKey()
50
-    {
46
+    public function getKey() {
51 47
         return $this->key;
52 48
     }
53 49
 
54 50
     /**
55 51
      * @return string
56 52
      */
57
-    public function getCounter()
58
-    {
53
+    public function getCounter() {
59 54
         return ParagonIE_Sodium_Core_Util::store32_le($this->counter);
60 55
     }
61 56
 
62 57
     /**
63 58
      * @return string
64 59
      */
65
-    public function getNonce()
66
-    {
60
+    public function getNonce() {
67 61
         if (!is_string($this->nonce)) {
68 62
             $this->nonce = str_repeat("\0", 12);
69 63
         }
@@ -76,8 +70,7 @@  discard block
 block discarded – undo
76 70
     /**
77 71
      * @return string
78 72
      */
79
-    public function getCombinedNonce()
80
-    {
73
+    public function getCombinedNonce() {
81 74
         return $this->getCounter() .
82 75
             ParagonIE_Sodium_Core_Util::substr($this->getNonce(), 0, 8);
83 76
     }
@@ -85,8 +78,7 @@  discard block
 block discarded – undo
85 78
     /**
86 79
      * @return self
87 80
      */
88
-    public function incrementCounter()
89
-    {
81
+    public function incrementCounter() {
90 82
         ++$this->counter;
91 83
         return $this;
92 84
     }
@@ -94,8 +86,7 @@  discard block
 block discarded – undo
94 86
     /**
95 87
      * @return bool
96 88
      */
97
-    public function needsRekey()
98
-    {
89
+    public function needsRekey() {
99 90
         return ($this->counter & 0xffff) === 0;
100 91
     }
101 92
 
@@ -103,8 +94,7 @@  discard block
 block discarded – undo
103 94
      * @param string $newKeyAndNonce
104 95
      * @return self
105 96
      */
106
-    public function rekey($newKeyAndNonce)
107
-    {
97
+    public function rekey($newKeyAndNonce) {
108 98
         $this->key = ParagonIE_Sodium_Core_Util::substr($newKeyAndNonce, 0, 32);
109 99
         $this->nonce = str_pad(
110 100
             ParagonIE_Sodium_Core_Util::substr($newKeyAndNonce, 32),
@@ -119,8 +109,7 @@  discard block
 block discarded – undo
119 109
      * @param string $str
120 110
      * @return self
121 111
      */
122
-    public function xorNonce($str)
123
-    {
112
+    public function xorNonce($str) {
124 113
         $this->nonce = ParagonIE_Sodium_Core_Util::xorStrings(
125 114
             $this->getNonce(),
126 115
             str_pad(
@@ -137,8 +126,7 @@  discard block
 block discarded – undo
137 126
      * @param string $string
138 127
      * @return self
139 128
      */
140
-    public static function fromString($string)
141
-    {
129
+    public static function fromString($string) {
142 130
         $state = new ParagonIE_Sodium_Core_SecretStream_State(
143 131
             ParagonIE_Sodium_Core_Util::substr($string, 0, 32)
144 132
         );
@@ -153,8 +141,7 @@  discard block
 block discarded – undo
153 141
     /**
154 142
      * @return string
155 143
      */
156
-    public function toString()
157
-    {
144
+    public function toString() {
158 145
         return $this->key .
159 146
             $this->getCounter() .
160 147
             $this->nonce .
Please login to merge, or discard this patch.