#!/usr/bin/perl
 
 
$chunk_size = 4096;  
 
while ($arg = shift(@ARGV)) { push (@cloptions,$arg); }
$filename = $cloptions[0];
sysopen (FILE, $filename, O_RDONLY) || die "Unable to open file: $!\n"; 
 
while ($actualread = sysread(FILE, $read_data, $chunk_size)) {
   @array_data = split(//, $read_data);
   map {$_ = join("",unpack("H*", $_)); } @array_data;
   $size = $#array_data;

   for (@array_data) {
      print "0x" . $_;
      if ($lpos == 11) {
         if ($size) { print ",\n"; }
         $lpos = 0;
      } else {
         if ($size) { print ", "; }
         $lpos++;
      } 
      $size--;
   }
   print "\n";
}
 
close(FILE);

