Subversion Repositories oidplus

Rev

Rev 874 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 874 Rev 1042
Line 3... Line 3...
3
/**
3
/**
4
 * Pure-PHP implementation of ChaCha20.
4
 * Pure-PHP implementation of ChaCha20.
5
 *
5
 *
6
 * PHP version 5
6
 * PHP version 5
7
 *
7
 *
8
 * @category  Crypt
-
 
9
 * @package   ChaCha20
-
 
10
 * @author    Jim Wigginton <terrafrost@php.net>
8
 * @author    Jim Wigginton <terrafrost@php.net>
11
 * @copyright 2019 Jim Wigginton
9
 * @copyright 2019 Jim Wigginton
12
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
10
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
13
 * @link      http://phpseclib.sourceforge.net
11
 * @link      http://phpseclib.sourceforge.net
14
 */
12
 */
Line 19... Line 17...
19
use phpseclib3\Exception\InsufficientSetupException;
17
use phpseclib3\Exception\InsufficientSetupException;
20
 
18
 
21
/**
19
/**
22
 * Pure-PHP implementation of ChaCha20.
20
 * Pure-PHP implementation of ChaCha20.
23
 *
21
 *
24
 * @package ChaCha20
-
 
25
 * @author  Jim Wigginton <terrafrost@php.net>
22
 * @author  Jim Wigginton <terrafrost@php.net>
26
 * @access  public
-
 
27
 */
23
 */
28
class ChaCha20 extends Salsa20
24
class ChaCha20 extends Salsa20
29
{
25
{
30
    /**
26
    /**
31
     * The OpenSSL specific name of the cipher
27
     * The OpenSSL specific name of the cipher
Line 39... Line 35...
39
     *
35
     *
40
     * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
36
     * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
41
     *
37
     *
42
     * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
38
     * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
43
     * @param int $engine
39
     * @param int $engine
44
     * @access protected
-
 
45
     * @return bool
40
     * @return bool
46
     */
41
     */
47
    protected function isValidEngineHelper($engine)
42
    protected function isValidEngineHelper($engine)
48
    {
43
    {
49
        switch ($engine) {
44
        switch ($engine) {
Line 282... Line 277...
282
    {
277
    {
283
        // in https://datatracker.ietf.org/doc/html/rfc7539#section-2.1 the addition,
278
        // in https://datatracker.ietf.org/doc/html/rfc7539#section-2.1 the addition,
284
        // xor'ing and rotation are all on the same line so i'm keeping it on the same
279
        // xor'ing and rotation are all on the same line so i'm keeping it on the same
285
        // line here as well
280
        // line here as well
286
        // @codingStandardsIgnoreStart
281
        // @codingStandardsIgnoreStart
287
        $a+= $b; $d = self::leftRotate($d ^ $a, 16);
282
        $a+= $b; $d = self::leftRotate(intval($d) ^ intval($a), 16);
288
        $c+= $d; $b = self::leftRotate($b ^ $c, 12);
283
        $c+= $d; $b = self::leftRotate(intval($b) ^ intval($c), 12);
289
        $a+= $b; $d = self::leftRotate($d ^ $a, 8);
284
        $a+= $b; $d = self::leftRotate(intval($d) ^ intval($a), 8);
290
        $c+= $d; $b = self::leftRotate($b ^ $c, 7);
285
        $c+= $d; $b = self::leftRotate(intval($b) ^ intval($c), 7);
291
        // @codingStandardsIgnoreEnd
286
        // @codingStandardsIgnoreEnd
292
    }
287
    }
293
 
288
 
294
    /**
289
    /**
295
     * The doubleround function
290
     * The doubleround function
Line 360... Line 355...
360
        $z14 = $x14;
355
        $z14 = $x14;
361
        $z15 = $x15;
356
        $z15 = $x15;
362
 
357
 
363
        // @codingStandardsIgnoreStart
358
        // @codingStandardsIgnoreStart
364
        // columnRound
359
        // columnRound
365
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
360
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
366
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
361
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
367
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
362
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
368
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
363
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
369
 
364
 
370
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
365
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
371
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
366
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
372
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
367
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
373
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
368
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
374
 
369
 
375
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
370
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
376
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
371
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
377
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
372
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
378
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
373
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
379
 
374
 
380
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
375
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
381
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
376
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
382
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
377
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
383
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
378
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
384
 
379
 
385
        // rowRound
380
        // rowRound
386
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
381
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
387
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
382
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
388
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
383
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
389
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
384
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
390
 
385
 
391
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
386
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
392
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
387
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
393
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
388
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
394
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
389
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
395
 
390
 
396
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
391
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
397
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
392
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
398
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
393
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
399
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
394
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
400
 
395
 
401
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
396
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
402
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
397
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
403
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
398
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
404
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
399
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
405
 
400
 
406
        // columnRound
401
        // columnRound
407
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
402
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
408
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
403
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
409
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
404
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
410
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
405
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
411
 
406
 
412
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
407
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
413
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
408
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
414
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
409
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
415
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
410
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
416
 
411
 
417
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
412
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
418
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
413
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
419
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
414
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
420
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
415
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
421
 
416
 
422
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
417
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
423
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
418
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
424
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
419
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
425
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
420
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
426
 
421
 
427
        // rowRound
422
        // rowRound
428
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
423
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
429
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
424
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
430
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
425
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
431
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
426
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
432
 
427
 
433
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
428
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
434
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
429
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
435
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
430
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
436
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
431
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
437
 
432
 
438
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
433
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
439
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
434
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
440
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
435
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
441
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
436
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
442
 
437
 
443
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
438
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
444
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
439
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
445
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
440
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
446
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
441
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
447
 
442
 
448
        // columnRound
443
        // columnRound
449
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
444
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
450
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
445
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
451
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
446
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
452
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
447
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
453
 
448
 
454
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
449
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
455
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
450
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
456
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
451
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
457
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
452
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
458
 
453
 
459
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
454
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
460
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
455
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
461
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
456
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
462
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
457
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
463
 
458
 
464
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
459
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
465
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
460
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
466
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
461
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
467
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
462
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
468
 
463
 
469
        // rowRound
464
        // rowRound
470
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
465
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
471
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
466
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
472
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
467
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
473
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
468
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
474
 
469
 
475
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
470
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
476
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
471
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
477
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
472
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
478
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
473
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
479
 
474
 
480
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
475
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
481
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
476
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
482
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
477
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
483
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
478
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
484
 
479
 
485
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
480
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
486
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
481
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
487
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
482
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
488
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
483
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
489
 
484
 
490
        // columnRound
485
        // columnRound
491
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
486
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
492
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
487
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
493
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
488
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
494
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
489
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
495
 
490
 
496
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
491
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
497
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
492
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
498
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
493
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
499
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
494
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
500
 
495
 
501
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
496
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
502
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
497
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
503
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
498
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
504
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
499
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
505
 
500
 
506
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
501
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
507
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
502
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
508
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
503
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
509
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
504
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
510
 
505
 
511
        // rowRound
506
        // rowRound
512
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
507
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
513
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
508
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
514
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
509
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
515
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
510
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
516
 
511
 
517
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
512
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
518
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
513
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
519
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
514
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
520
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
515
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
521
 
516
 
522
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
517
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
523
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
518
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
524
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
519
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
525
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
520
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
526
 
521
 
527
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
522
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
528
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
523
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
529
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
524
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
530
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
525
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
531
 
526
 
532
        // columnRound
527
        // columnRound
533
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
528
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
534
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
529
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
535
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
530
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
536
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
531
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
537
 
532
 
538
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
533
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
539
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
534
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
540
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
535
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
541
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
536
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
542
 
537
 
543
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
538
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
544
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
539
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
545
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
540
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
546
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
541
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
547
 
542
 
548
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
543
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
549
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
544
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
550
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
545
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
551
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
546
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
552
 
547
 
553
        // rowRound
548
        // rowRound
554
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
549
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
555
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
550
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
556
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
551
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
557
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
552
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
558
 
553
 
559
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
554
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
560
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
555
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
561
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
556
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
562
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
557
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
563
 
558
 
564
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
559
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
565
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
560
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
566
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
561
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
567
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
562
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
568
 
563
 
569
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
564
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
570
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
565
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
571
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
566
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
572
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
567
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
573
 
568
 
574
        // columnRound
569
        // columnRound
575
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
570
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
576
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
571
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
577
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
572
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
578
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
573
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
579
 
574
 
580
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
575
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
581
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
576
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
582
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
577
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
583
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
578
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
584
 
579
 
585
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
580
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
586
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
581
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
587
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
582
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
588
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
583
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
589
 
584
 
590
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
585
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
591
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
586
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
592
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
587
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
593
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
588
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
594
 
589
 
595
        // rowRound
590
        // rowRound
596
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
591
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
597
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
592
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
598
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
593
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
599
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
594
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
600
 
595
 
601
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
596
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
602
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
597
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
603
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
598
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
604
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
599
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
605
 
600
 
606
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
601
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
607
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
602
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
608
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
603
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
609
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
604
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
610
 
605
 
611
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
606
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
612
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
607
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
613
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
608
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
614
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
609
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
615
 
610
 
616
        // columnRound
611
        // columnRound
617
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
612
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
618
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
613
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
619
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
614
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
620
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
615
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
621
 
616
 
622
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
617
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
623
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
618
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
624
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
619
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
625
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
620
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
626
 
621
 
627
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
622
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
628
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
623
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
629
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
624
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
630
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
625
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
631
 
626
 
632
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
627
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
633
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
628
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
634
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
629
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
635
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
630
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
636
 
631
 
637
        // rowRound
632
        // rowRound
638
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
633
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
639
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
634
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
640
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
635
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
641
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
636
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
642
 
637
 
643
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
638
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
644
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
639
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
645
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
640
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
646
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
641
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
647
 
642
 
648
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
643
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
649
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
644
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
650
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
645
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
651
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
646
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
652
 
647
 
653
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
648
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
654
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
649
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
655
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
650
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
656
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
651
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
657
 
652
 
658
        // columnRound
653
        // columnRound
659
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
654
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
660
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
655
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
661
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
656
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
662
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
657
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
663
 
658
 
664
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
659
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
665
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
660
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
666
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
661
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
667
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
662
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
668
 
663
 
669
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
664
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
670
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
665
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
671
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
666
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
672
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
667
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
673
 
668
 
674
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
669
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
675
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
670
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
676
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
671
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
677
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
672
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
678
 
673
 
679
        // rowRound
674
        // rowRound
680
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
675
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
681
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
676
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
682
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
677
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
683
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
678
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
684
 
679
 
685
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
680
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
686
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
681
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
687
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
682
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
688
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
683
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
689
 
684
 
690
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
685
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
691
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
686
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
692
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
687
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
693
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
688
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
694
 
689
 
695
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
690
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
696
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
691
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
697
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
692
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
698
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
693
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
699
 
694
 
700
        // columnRound
695
        // columnRound
701
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
696
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
702
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
697
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
703
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
698
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
704
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
699
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
705
 
700
 
706
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
701
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
707
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
702
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
708
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
703
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
709
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
704
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
710
 
705
 
711
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
706
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
712
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
707
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
713
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
708
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
714
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
709
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
715
 
710
 
716
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
711
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
717
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
712
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
718
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
713
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
719
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
714
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
720
 
715
 
721
        // rowRound
716
        // rowRound
722
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
717
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
723
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
718
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
724
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
719
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
725
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
720
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
726
 
721
 
727
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
722
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
728
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
723
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
729
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
724
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
730
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
725
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
731
 
726
 
732
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
727
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
733
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
728
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
734
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
729
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
735
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
730
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
736
 
731
 
737
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
732
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
738
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
733
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
739
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
734
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
740
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
735
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
741
 
736
 
742
        // columnRound
737
        // columnRound
743
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 16);
738
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16);
744
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 12);
739
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12);
745
        $x0+= $x4; $x12 = self::leftRotate($x12 ^ $x0, 8);
740
        $x0+= $x4; $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8);
746
        $x8+= $x12; $x4 = self::leftRotate($x4 ^ $x8, 7);
741
        $x8+= $x12; $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7);
747
 
742
 
748
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 16);
743
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16);
749
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 12);
744
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12);
750
        $x1+= $x5; $x13 = self::leftRotate($x13 ^ $x1, 8);
745
        $x1+= $x5; $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8);
751
        $x9+= $x13; $x5 = self::leftRotate($x5 ^ $x9, 7);
746
        $x9+= $x13; $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7);
752
 
747
 
753
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 16);
748
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16);
754
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 12);
749
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12);
755
        $x2+= $x6; $x14 = self::leftRotate($x14 ^ $x2, 8);
750
        $x2+= $x6; $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8);
756
        $x10+= $x14; $x6 = self::leftRotate($x6 ^ $x10, 7);
751
        $x10+= $x14; $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7);
757
 
752
 
758
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 16);
753
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16);
759
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 12);
754
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12);
760
        $x3+= $x7; $x15 = self::leftRotate($x15 ^ $x3, 8);
755
        $x3+= $x7; $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8);
761
        $x11+= $x15; $x7 = self::leftRotate($x7 ^ $x11, 7);
756
        $x11+= $x15; $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7);
762
 
757
 
763
        // rowRound
758
        // rowRound
764
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 16);
759
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16);
765
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 12);
760
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12);
766
        $x0+= $x5; $x15 = self::leftRotate($x15 ^ $x0, 8);
761
        $x0+= $x5; $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8);
767
        $x10+= $x15; $x5 = self::leftRotate($x5 ^ $x10, 7);
762
        $x10+= $x15; $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7);
768
 
763
 
769
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 16);
764
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16);
770
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 12);
765
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12);
771
        $x1+= $x6; $x12 = self::leftRotate($x12 ^ $x1, 8);
766
        $x1+= $x6; $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8);
772
        $x11+= $x12; $x6 = self::leftRotate($x6 ^ $x11, 7);
767
        $x11+= $x12; $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7);
773
 
768
 
774
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 16);
769
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16);
775
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 12);
770
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12);
776
        $x2+= $x7; $x13 = self::leftRotate($x13 ^ $x2, 8);
771
        $x2+= $x7; $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8);
777
        $x8+= $x13; $x7 = self::leftRotate($x7 ^ $x8, 7);
772
        $x8+= $x13; $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7);
778
 
773
 
779
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 16);
774
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16);
780
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 12);
775
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12);
781
        $x3+= $x4; $x14 = self::leftRotate($x14 ^ $x3, 8);
776
        $x3+= $x4; $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8);
782
        $x9+= $x14; $x4 = self::leftRotate($x4 ^ $x9, 7);
777
        $x9+= $x14; $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7);
783
        // @codingStandardsIgnoreEnd
778
        // @codingStandardsIgnoreEnd
784
 
779
 
785
        $x0 += $z0;
780
        $x0 += $z0;
786
        $x1 += $z1;
781
        $x1 += $z1;
787
        $x2 += $z2;
782
        $x2 += $z2;