Subversion Repositories oidplus

Rev

Rev 846 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 846 Rev 874
Line 3... Line 3...
3
/**
3
/**
4
 * Pure-PHP implementation of Salsa20.
4
 * Pure-PHP implementation of Salsa20.
5
 *
5
 *
6
 * PHP version 5
6
 * PHP version 5
7
 *
7
 *
-
 
8
 * @category  Crypt
-
 
9
 * @package   Salsa20
8
 * @author    Jim Wigginton <terrafrost@php.net>
10
 * @author    Jim Wigginton <terrafrost@php.net>
9
 * @copyright 2019 Jim Wigginton
11
 * @copyright 2019 Jim Wigginton
10
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
12
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
11
 * @link      http://phpseclib.sourceforge.net
13
 * @link      http://phpseclib.sourceforge.net
12
 */
14
 */
Line 19... Line 21...
19
use phpseclib3\Exception\InsufficientSetupException;
21
use phpseclib3\Exception\InsufficientSetupException;
20
 
22
 
21
/**
23
/**
22
 * Pure-PHP implementation of Salsa20.
24
 * Pure-PHP implementation of Salsa20.
23
 *
25
 *
-
 
26
 * @package Salsa20
24
 * @author  Jim Wigginton <terrafrost@php.net>
27
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
28
 * @access  public
25
 */
29
 */
26
class Salsa20 extends StreamCipher
30
class Salsa20 extends StreamCipher
27
{
31
{
28
    /**
32
    /**
29
     * Part 1 of the state
33
     * Part 1 of the state
Line 45... Line 49...
45
     * @var int
49
     * @var int
46
     */
50
     */
47
    protected $key_length = 32; // = 256 bits
51
    protected $key_length = 32; // = 256 bits
48
 
52
 
49
    /**
53
    /**
-
 
54
     * @access private
50
     * @see \phpseclib3\Crypt\Salsa20::crypt()
55
     * @see \phpseclib3\Crypt\Salsa20::crypt()
51
     */
56
     */
52
    const ENCRYPT = 0;
57
    const ENCRYPT = 0;
53
 
58
 
54
    /**
59
    /**
-
 
60
     * @access private
55
     * @see \phpseclib3\Crypt\Salsa20::crypt()
61
     * @see \phpseclib3\Crypt\Salsa20::crypt()
56
     */
62
     */
57
    const DECRYPT = 1;
63
    const DECRYPT = 1;
58
 
64
 
59
    /**
65
    /**
Line 487... Line 493...
487
    /**
493
    /**
488
     * Calculates Poly1305 MAC
494
     * Calculates Poly1305 MAC
489
     *
495
     *
490
     * @see self::decrypt()
496
     * @see self::decrypt()
491
     * @see self::encrypt()
497
     * @see self::encrypt()
-
 
498
     * @access private
492
     * @param string $ciphertext
499
     * @param string $ciphertext
493
     * @return string
500
     * @return string
494
     */
501
     */
495
    protected function poly1305($ciphertext)
502
    protected function poly1305($ciphertext)
496
    {
503
    {