Logo Search packages:      
Sourcecode: acidbase version File versions  Download package

Cpdf::ARC4 ( text )

ARC4 encrypt a text string

Definition at line 1138 of file class.pdf.php.

Referenced by o_action(), o_contents(), o_encryption(), o_image(), and o_info().

                    {
  $len=strlen($text);
  $a=0;
  $b=0;
  $c = $this->arc4;
  $out='';
  for ($i=0;$i<$len;$i++){
    $a = ($a+1)%256;
    $t= $c[$a];
    $b = ($b+ord($t))%256;
    $c[$a]=$c[$b];
    $c[$b]=$t;
    $k = ord($c[(ord($c[$a])+ord($c[$b]))%256]);
    $out.=chr(ord($text[$i]) ^ $k);
  }
  
  return $out;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index