You are here

public function PHPExcel_Reader_Excel5_RC4::__construct in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/RC4.php \PHPExcel_Reader_Excel5_RC4::__construct()

* RC4 stream decryption/encryption constrcutor * *

Parameters

string $key Encryption key/passphrase:

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/RC4.php, line 47

Class

PHPExcel_Reader_Excel5_RC4
PHPExcel_Reader_Excel5_RC4

Code

public function __construct($key) {
  $len = strlen($key);
  for ($this->i = 0; $this->i < 256; $this->i++) {
    $this->s[$this->i] = $this->i;
  }
  $this->j = 0;
  for ($this->i = 0; $this->i < 256; $this->i++) {
    $this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
    $t = $this->s[$this->i];
    $this->s[$this->i] = $this->s[$this->j];
    $this->s[$this->j] = $t;
  }
  $this->i = $this->j = 0;
}