2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2002 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Author: Xavier Noguer <xnoguer@php.net> |
17 // | Based on OLE::Storage_Lite by Kawai, Takanori |
18 // +----------------------------------------------------------------------+
20 // $Id: Root.php 322720 2012-01-25 12:56:57Z clockwerx $
23 require_once 'OLE/PPS.php';
24 require_once 'System.php';
27 * Class for creating Root PPS's for OLE containers
29 * @author Xavier Noguer <xnoguer@php.net>
30 * @category Structures
33 class OLE_PPS_Root extends OLE_PPS
36 * Flag to enable new logic
42 * The temporary dir for storing the OLE file
49 var $_SMALL_BLOCK_SIZE;
55 * @param integer $time_1st A timestamp
56 * @param integer $time_2nd A timestamp
58 function __construct($time_1st, $time_2nd, $raChild)
60 $this->_tmp_dir = System::tmpdir();
63 OLE::Asc2Ucs('Root Entry'),
75 * Sets the temp dir used for storing the OLE file
78 * @param string $dir The dir to be used as temp dir
79 * @return true if given dir is valid, false otherwise
81 function setTempDir($dir)
84 $this->_tmp_dir = $dir;
91 * Method for saving the whole OLE container (including files).
92 * In fact, if called with an empty argument (or '-'), it saves to a
93 * temporary file and then outputs it's contents to stdout.
95 * @param string $filename The name of the file where to save the OLE container
97 * @return mixed true on success, PEAR_Error on failure
99 function save($filename)
101 // Initial Setting for saving
102 $this->_BIG_BLOCK_SIZE = pow(2,
103 ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9));
104 $this->_SMALL_BLOCK_SIZE= pow(2,
105 ((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6));
107 // Open temp file if we are sending output to stdout
108 if (($filename == '-') || ($filename == '')) {
109 $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
110 $this->_FILEH_ = @fopen($this->_tmp_filename,"w+b");
111 if ($this->_FILEH_ == false) {
112 return $this->raiseError("Can't create temporary file.");
115 $this->_FILEH_ = @fopen($filename, "wb");
116 if ($this->_FILEH_ == false) {
117 return $this->raiseError("Can't open $filename. It may be in use or protected.");
120 // Make an array of PPS's (for Save)
122 OLE_PPS_Root::_savePpsSetPnt($aList, array($this));
123 // calculate values for header
124 list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
126 $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);
128 // Make Small Data string (write SBD)
129 $this->_data = $this->_makeSmallData($aList);
132 $this->_saveBigData($iSBDcnt, $aList);
134 $this->_savePps($aList);
135 // Write Big Block Depot and BDList and Adding Header informations
136 $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
137 // Close File, send it to stdout if necessary
138 if (($filename == '-') || ($filename == '')) {
139 fseek($this->_FILEH_, 0);
140 fpassthru($this->_FILEH_);
141 @fclose($this->_FILEH_);
142 // Delete the temporary file.
143 @unlink($this->_tmp_filename);
145 @fclose($this->_FILEH_);
152 * Calculate some numbers
155 * @param array $raList Reference to an array of PPS's
156 * @return array The array of numbers
158 function _calcSize(&$raList)
160 // Calculate Basic Setting
161 list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
164 for ($i = 0; $i < count($raList); $i++) {
165 if ($raList[$i]->Type == OLE_PPS_TYPE_FILE) {
166 $raList[$i]->Size = $raList[$i]->_DataLen();
167 if ($raList[$i]->Size < OLE_DATA_SIZE_SMALL) {
168 $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
169 + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
171 $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
172 (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
176 $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
177 $iSlCnt = floor($this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE);
178 $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
179 $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
180 (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
181 $iCnt = count($raList);
182 $iBdCnt = $this->_BIG_BLOCK_SIZE / OLE_PPS_SIZE;
183 $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
185 return array($iSBDcnt, $iBBcnt, $iPPScnt);
189 * Helper function for caculating a magic value for block sizes
192 * @param integer $i2 The argument
196 function _adjust2($i2)
198 $iWk = log($i2)/log(2);
199 return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
206 * @param integer $iSBDcnt
207 * @param integer $iBBcnt
208 * @param integer $iPPScnt
210 function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
212 $FILE = $this->_FILEH_;
215 return $this->_create_header($iSBDcnt, $iBBcnt, $iPPScnt);
217 // Calculate Basic Setting
218 $iBlCnt = $this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE;
219 $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / OLE_LONG_INT_SIZE;
222 $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
224 $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
225 $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
227 // Calculate BD count
228 if ($iBdCnt > $i1stBdL) {
232 $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
233 $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
234 if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
242 "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
256 . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
259 . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
260 . pack("V", $iSBDcnt)
262 // Extra BDList Start, Count
263 if ($iBdCnt < $i1stBdL) {
265 pack("V", -2). // Extra BDList Start
266 pack("V", 0) // Extra BDList Count
269 fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
273 for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; $i++) {
274 fwrite($FILE, pack("V", $iAll+$i));
277 for ($j = 0; $j < ($i1stBdL-$i); $j++) {
278 fwrite($FILE, (pack("V", -1)));
284 * Saving big data (PPS's with data bigger than OLE_DATA_SIZE_SMALL)
287 * @param integer $iStBlk
288 * @param array &$raList Reference to array of PPS's
290 function _saveBigData($iStBlk, &$raList)
292 $FILE = $this->_FILEH_;
294 // cycle through PPS's
295 for ($i = 0; $i < count($raList); $i++) {
296 if ($raList[$i]->Type != OLE_PPS_TYPE_DIR) {
297 $raList[$i]->Size = $raList[$i]->_DataLen();
298 if (($raList[$i]->Size >= OLE_DATA_SIZE_SMALL) ||
299 (($raList[$i]->Type == OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
302 if (isset($raList[$i]->_PPS_FILE)) {
304 fseek($raList[$i]->_PPS_FILE, 0); // To The Top
305 while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
306 $iLen += strlen($sBuff);
307 fwrite($FILE, $sBuff);
310 fwrite($FILE, $raList[$i]->_data);
313 if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
314 for ($j = 0; $j < ($this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)); $j++) {
315 fwrite($FILE, "\x00");
319 $raList[$i]->_StartBlock = $iStBlk;
321 (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
322 (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
324 // Close file for each PPS, and unlink it
325 if (isset($raList[$i]->_PPS_FILE)) {
326 @fclose($raList[$i]->_PPS_FILE);
327 $raList[$i]->_PPS_FILE = null;
328 @unlink($raList[$i]->_tmp_filename);
335 * get small data (PPS's with data smaller than OLE_DATA_SIZE_SMALL)
338 * @param array &$raList Reference to array of PPS's
340 function _makeSmallData(&$raList)
343 $FILE = $this->_FILEH_;
346 for ($i = 0; $i < count($raList); $i++) {
347 // Make SBD, small data string
348 if ($raList[$i]->Type == OLE_PPS_TYPE_FILE) {
349 if ($raList[$i]->Size <= 0) {
352 if ($raList[$i]->Size < OLE_DATA_SIZE_SMALL) {
353 $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
354 + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
356 for ($j = 0; $j < ($iSmbCnt-1); $j++) {
357 fwrite($FILE, pack("V", $j+$iSmBlk+1));
359 fwrite($FILE, pack("V", -2));
361 // Add to Data String(this will be written for RootEntry)
362 if ($raList[$i]->_PPS_FILE) {
363 fseek($raList[$i]->_PPS_FILE, 0); // To The Top
364 while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
368 $sRes .= $raList[$i]->_data;
370 if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
371 for ($j = 0; $j < ($this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)); $j++) {
376 $raList[$i]->_StartBlock = $iSmBlk;
381 $iSbCnt = floor($this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE);
382 if ($iSmBlk % $iSbCnt) {
383 for ($i = 0; $i < ($iSbCnt - ($iSmBlk % $iSbCnt)); $i++) {
384 fwrite($FILE, pack("V", -1));
391 * Saves all the PPS's WKs
394 * @param array $raList Reference to an array with all PPS's
396 function _savePps(&$raList)
399 for ($i = 0; $i < count($raList); $i++) {
400 fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
403 $iCnt = count($raList);
404 $iBCnt = $this->_BIG_BLOCK_SIZE / OLE_PPS_SIZE;
405 if ($iCnt % $iBCnt) {
406 for ($i = 0; $i < (($iBCnt - ($iCnt % $iBCnt)) * OLE_PPS_SIZE); $i++) {
407 fwrite($this->_FILEH_, "\x00");
413 * Saving Big Block Depot
416 * @param integer $iSbdSize
417 * @param integer $iBsize
418 * @param integer $iPpsCnt
420 function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
423 return $this->_create_big_block_chain($iSbdSize, $iBsize, $iPpsCnt);
425 $FILE = $this->_FILEH_;
426 // Calculate Basic Setting
427 $iBbCnt = $this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE;
428 $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / OLE_LONG_INT_SIZE;
431 $iAll = $iBsize + $iPpsCnt + $iSbdSize;
433 $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
434 $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
435 // Calculate BD count
436 if ($iBdCnt >$i1stBdL) {
440 $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
441 $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
442 if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
451 for ($i = 0; $i < ($iSbdSize - 1); $i++) {
452 fwrite($FILE, pack("V", $i+1));
454 fwrite($FILE, pack("V", -2));
457 for ($i = 0; $i < ($iBsize - 1); $i++) {
458 fwrite($FILE, pack("V", $i+$iSbdSize+1));
460 fwrite($FILE, pack("V", -2));
463 for ($i = 0; $i < ($iPpsCnt - 1); $i++) {
464 fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
466 fwrite($FILE, pack("V", -2));
467 // Set for BBD itself ( 0xFFFFFFFD : BBD)
468 for ($i = 0; $i < $iBdCnt; $i++) {
469 fwrite($FILE, pack("V", 0xFFFFFFFD));
471 // Set for ExtraBDList
472 for ($i = 0; $i < $iBdExL; $i++) {
473 fwrite($FILE, pack("V", 0xFFFFFFFC));
476 if (($iAllW + $iBdCnt) % $iBbCnt) {
477 for ($i = 0; $i < ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt)); $i++) {
478 fwrite($FILE, pack("V", -1));
482 if ($iBdCnt > $i1stBdL) {
485 for ($i = $i1stBdL;$i < $iBdCnt; $i++, $iN++) {
486 if ($iN >= ($iBbCnt - 1)) {
489 fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
491 fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
493 if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
494 for ($i = 0; $i < (($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1))); $i++) {
495 fwrite($FILE, pack("V", -1));
498 fwrite($FILE, pack("V", -2));
505 * New method to store Bigblock chain
508 * @param integer $num_sb_blocks - number of Smallblock depot blocks
509 * @param integer $num_bb_blocks - number of Bigblock depot blocks
510 * @param integer $num_pps_blocks - number of PropertySetStorage blocks
512 function _create_big_block_chain($num_sb_blocks, $num_bb_blocks, $num_pps_blocks)
514 $FILE = $this->_FILEH_;
516 $bbd_info = $this->_calculate_big_block_chain($num_sb_blocks, $num_bb_blocks, $num_pps_blocks);
520 if($num_sb_blocks > 0)
522 for($i = 0; $i<($num_sb_blocks-1); $i++)
523 $data .= pack("V", $i+1);
524 $data .= pack("V", -2);
527 for($i = 0; $i<($num_bb_blocks-1); $i++)
528 $data .= pack("V", $i + $num_sb_blocks + 1);
529 $data .= pack("V", -2);
531 for($i = 0; $i<($num_pps_blocks-1); $i++)
532 $data .= pack("V", $i + $num_sb_blocks + $num_bb_blocks + 1);
533 $data .= pack("V", -2);
535 for($i = 0; $i < $bbd_info["0xFFFFFFFD_blockchain_entries"]; $i++)
536 $data .= pack("V", 0xFFFFFFFD);
538 for($i = 0; $i < $bbd_info["0xFFFFFFFC_blockchain_entries"]; $i++)
539 $data .= pack("V", 0xFFFFFFFC);
542 $all_entries = $num_sb_blocks + $num_bb_blocks + $num_pps_blocks + $bbd_info["0xFFFFFFFD_blockchain_entries"] + $bbd_info["0xFFFFFFFC_blockchain_entries"];
543 if($all_entries % $bbd_info["entries_per_block"])
545 $rest = $bbd_info["entries_per_block"] - ($all_entries % $bbd_info["entries_per_block"]);
546 for($i = 0; $i < $rest; $i++)
547 $data .= pack("V", -1);
551 if($bbd_info["blockchain_list_entries"] > $bbd_info["header_blockchain_list_entries"])
555 for($i = $bbd_info["header_blockchain_list_entries"]; $i < $bbd_info["blockchain_list_entries"]; $i++, $iN++)
557 if($iN >= ($bbd_info["entries_per_block"]-1))
561 $data .= pack("V", $num_sb_blocks + $num_bb_blocks + $num_pps_blocks + $bbd_info["0xFFFFFFFD_blockchain_entries"] + $iNb);
564 $data .= pack("V", $num_bb_blocks + $num_sb_blocks + $num_pps_blocks + $i);
567 $all_entries = $bbd_info["blockchain_list_entries"] - $bbd_info["header_blockchain_list_entries"];
568 if(($all_entries % ($bbd_info["entries_per_block"] - 1)))
570 $rest = ($bbd_info["entries_per_block"] - 1) - ($all_entries % ($bbd_info["entries_per_block"] - 1));
571 for($i = 0; $i < $rest; $i++)
572 $data .= pack("V", -1);
575 $data .= pack("V", -2);
579 $this->dump($data, 0, strlen($data));
583 fwrite($FILE, $data);
587 * New method to store Header
590 * @param integer $num_sb_blocks - number of Smallblock depot blocks
591 * @param integer $num_bb_blocks - number of Bigblock depot blocks
592 * @param integer $num_pps_blocks - number of PropertySetStorage blocks
594 function _create_header($num_sb_blocks, $num_bb_blocks, $num_pps_blocks)
596 $FILE = $this->_FILEH_;
598 $bbd_info = $this->_calculate_big_block_chain($num_sb_blocks, $num_bb_blocks, $num_pps_blocks);
602 "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
615 . pack("V", $bbd_info["blockchain_list_entries"])
616 . pack("V", $num_sb_blocks + $num_bb_blocks) //ROOT START
622 if($num_sb_blocks > 0)
623 fwrite($FILE, pack("V", 0));
625 fwrite($FILE, pack("V", -2));
627 fwrite($FILE, pack("V", $num_sb_blocks));
629 // Extra BDList Start, Count
630 if($bbd_info["blockchain_list_entries"] < $bbd_info["header_blockchain_list_entries"])
633 pack("V", -2). // Extra BDList Start
634 pack("V", 0) // Extra BDList Count
639 fwrite($FILE, pack("V", $num_sb_blocks + $num_bb_blocks + $num_pps_blocks + $bbd_info["0xFFFFFFFD_blockchain_entries"]) . pack("V", $bbd_info["0xFFFFFFFC_blockchain_entries"]));
643 for ($i=0; $i < $bbd_info["header_blockchain_list_entries"] and $i < $bbd_info["blockchain_list_entries"]; $i++)
645 fwrite($FILE, pack("V", $num_bb_blocks + $num_sb_blocks + $num_pps_blocks + $i));
648 if($i < $bbd_info["header_blockchain_list_entries"])
650 for($j = 0; $j < ($bbd_info["header_blockchain_list_entries"]-$i); $j++)
652 fwrite($FILE, (pack("V", -1)));
658 * New method to calculate Bigblock chain
661 * @param integer $num_sb_blocks - number of Smallblock depot blocks
662 * @param integer $num_bb_blocks - number of Bigblock depot blocks
663 * @param integer $num_pps_blocks - number of PropertySetStorage blocks
665 function _calculate_big_block_chain($num_sb_blocks, $num_bb_blocks, $num_pps_blocks)
667 $bbd_info["entries_per_block"] = $this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE;
668 $bbd_info["header_blockchain_list_entries"] = ($this->_BIG_BLOCK_SIZE - 0x4C) / OLE_LONG_INT_SIZE;
669 $bbd_info["blockchain_entries"] = $num_sb_blocks + $num_bb_blocks + $num_pps_blocks;
670 $bbd_info["0xFFFFFFFD_blockchain_entries"] = $this->get_number_of_pointer_blocks($bbd_info["blockchain_entries"]);
671 $bbd_info["blockchain_list_entries"] = $this->get_number_of_pointer_blocks($bbd_info["blockchain_entries"] + $bbd_info["0xFFFFFFFD_blockchain_entries"]);
674 $bbd_info["ext_blockchain_list_entries"] = 0;
675 $bbd_info["0xFFFFFFFC_blockchain_entries"] = 0;
676 if($bbd_info["blockchain_list_entries"] > $bbd_info["header_blockchain_list_entries"])
680 $bbd_info["blockchain_list_entries"] = $this->get_number_of_pointer_blocks($bbd_info["blockchain_entries"] + $bbd_info["0xFFFFFFFD_blockchain_entries"] + $bbd_info["0xFFFFFFFC_blockchain_entries"]);
681 $bbd_info["ext_blockchain_list_entries"] = $bbd_info["blockchain_list_entries"] - $bbd_info["header_blockchain_list_entries"];
682 $bbd_info["0xFFFFFFFC_blockchain_entries"] = $this->get_number_of_pointer_blocks($bbd_info["ext_blockchain_list_entries"]);
683 $bbd_info["0xFFFFFFFD_blockchain_entries"] = $this->get_number_of_pointer_blocks($num_sb_blocks + $num_bb_blocks + $num_pps_blocks + $bbd_info["0xFFFFFFFD_blockchain_entries"] + $bbd_info["0xFFFFFFFC_blockchain_entries"]);
685 while($bbd_info["blockchain_list_entries"] < $this->get_number_of_pointer_blocks($bbd_info["blockchain_entries"] + $bbd_info["0xFFFFFFFD_blockchain_entries"] + $bbd_info["0xFFFFFFFC_blockchain_entries"]));
692 * Calculates number of pointer blocks
695 * @param integer $num_pointers - number of pointers
697 function get_number_of_pointer_blocks($num_pointers)
699 $pointers_per_block = $this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE;
701 return floor($num_pointers / $pointers_per_block) + (($num_pointers % $pointers_per_block)? 1: 0);
705 * Support method for some hexdumping
708 * @param string $data - Binary data
709 * @param integer $from - Start offset of data to dump
710 * @param integer $to - Target offset of data to dump
712 function dump($data, $from, $to)
716 for($i = $from; $i < $to; $i++)
718 if(sizeof($chars) == 16)
720 printf("%08X (% 12d) |", $i-16, $i-16);
721 foreach($chars as $char)
722 printf(" %02X", $char);
728 $chars[] = ord($data[$i]);
733 printf("%08X (% 12d) |", $i-sizeof($chars), $i-sizeof($chars));
734 foreach($chars as $char)
735 printf(" %02X", $char);