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

Cpdf::ARC4_init ( key = '' )

initialize the ARC4 encryption

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

Referenced by encryptInit(), o_encryption(), and output().

                           {
  $this->arc4 = '';
  // setup the control array
  if (strlen($key)==0){
    return;
  }
  $k = '';
  while(strlen($k)<256){
    $k.=$key;
  }
  $k=substr($k,0,256);
  for ($i=0;$i<256;$i++){
    $this->arc4 .= chr($i);
  }
  $j=0;
  for ($i=0;$i<256;$i++){
    $t = $this->arc4[$i];
    $j = ($j + ord($t) + ord($k[$i]))%256;
    $this->arc4[$i]=$this->arc4[$j];
    $this->arc4[$j]=$t;
  }    
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index