function hextract()
{ 
  if [ $# -gt 3 ]; then
    HEX2DEC_START=$((16#${2}))
    HEX2DEC_END=$((16#${3}))
    dd if="${1}" of="${4}" bs=4096 count=$((${HEX2DEC_END}-${HEX2DEC_START})) skip=${HEX2DEC_START} iflag=count_bytes,skip_bytes
  else
    echo "${FUNCNAME} <infile> <startoffset 0x> <endoffset 0x> <outfile>"
  fi
}