Advertisement
Guest User

picture style decoded tags 0x10

a guest
Sep 29th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2.  
  3. function read_as_byte($filename){
  4.     $handle = fopen($filename, "rb");
  5.     $fsize = filesize($filename);
  6.     $contents = fread($handle, $fsize);
  7.     $byteArray = unpack("C*",$contents);
  8.     return $byteArray;
  9. }
  10.  
  11. $key = read_as_byte("./canon_ps.key");
  12. $enc_file = read_as_byte("./picturestyle.pf3");
  13.  
  14. $i = -11;
  15. $dec = array();
  16.  
  17. foreach($enc_file as $ef){
  18.     if($i>-1){
  19.         $dec[] = $ef^$key[$i];
  20.         $i = $i%(512*513);
  21.     }
  22.     else
  23.     {
  24.         $dec[] = $ef;
  25.     }
  26.     $i++;
  27. }
  28. for($c=0;$c<count($dec);$c++){
  29.     $val = $dec[$c];
  30.     if($val==0x10){
  31.         $c++;
  32.         echo "<br/><br/>".$val." ".$dec[$c]."<br/><br/>";
  33.     }
  34.     else{
  35.         echo $dec[$c]." ";
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement