public function PHPExcel_Reader_Excel5_RC4::RC4 in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/RC4.php \PHPExcel_Reader_Excel5_RC4::RC4()
* Symmetric decryption/encryption function * *
Parameters
string $data Data to encrypt/decrypt: * * @return string
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5/ RC4.php, line 72
Class
- PHPExcel_Reader_Excel5_RC4
- PHPExcel_Reader_Excel5_RC4
Code
public function RC4($data) {
$len = strlen($data);
for ($c = 0; $c < $len; $c++) {
$this->i = ($this->i + 1) % 256;
$this->j = ($this->j + $this->s[$this->i]) % 256;
$t = $this->s[$this->i];
$this->s[$this->i] = $this->s[$this->j];
$this->s[$this->j] = $t;
$t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
$data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
}
return $data;
}