ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Reader_Excel5_RC4 Class Reference
+ Collaboration diagram for PHPExcel_Reader_Excel5_RC4:

Public Member Functions

 __construct ($key)
 RC4 stream decryption/encryption constrcutor. More...
 
 RC4 ($data)
 Symmetric decryption/encryption function. More...
 

Data Fields

 $s = array()
 
 $i = 0
 
 $j = 0
 

Detailed Description

Definition at line 35 of file RC4.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Reader_Excel5_RC4::__construct (   $key)

RC4 stream decryption/encryption constrcutor.

Parameters
string$keyEncryption key/passphrase

Definition at line 47 of file RC4.php.

References $i, $j, $key, $t, and s.

48  {
49  $len = strlen($key);
50 
51  for ($this->i = 0; $this->i < 256; $this->i++) {
52  $this->s[$this->i] = $this->i;
53  }
54 
55  $this->j = 0;
56  for ($this->i = 0; $this->i < 256; $this->i++) {
57  $this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
58  $t = $this->s[$this->i];
59  $this->s[$this->i] = $this->s[$this->j];
60  $this->s[$this->j] = $t;
61  }
62  $this->i = $this->j = 0;
63  }
Add data(end) s
$key
Definition: croninfo.php:18

Member Function Documentation

◆ RC4()

PHPExcel_Reader_Excel5_RC4::RC4 (   $data)

Symmetric decryption/encryption function.

Parameters
string$dataData to encrypt/decrypt
Returns
string

Definition at line 72 of file RC4.php.

References $data, $i, $j, $t, and s.

73  {
74  $len = strlen($data);
75  for ($c = 0; $c < $len; $c++) {
76  $this->i = ($this->i + 1) % 256;
77  $this->j = ($this->j + $this->s[$this->i]) % 256;
78  $t = $this->s[$this->i];
79  $this->s[$this->i] = $this->s[$this->j];
80  $this->s[$this->j] = $t;
81 
82  $t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
83 
84  $data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
85  }
86  return $data;
87  }
Add data(end) s

Field Documentation

◆ $i

PHPExcel_Reader_Excel5_RC4::$i = 0

Definition at line 39 of file RC4.php.

Referenced by __construct(), and RC4().

◆ $j

PHPExcel_Reader_Excel5_RC4::$j = 0

Definition at line 40 of file RC4.php.

Referenced by __construct(), and RC4().

◆ $s

PHPExcel_Reader_Excel5_RC4::$s = array()

Definition at line 38 of file RC4.php.


The documentation for this class was generated from the following file: