def s_hex_dump(data, addr=0):
 dump = slice = ''
 for byte in data:
  if ((addr % 16) == 0):
   dump += ' '
   for char in slice:
    if ((ord(char) >= 32) and (ord(char) <= 126)):
     dump += char
    else:
     dump += '.'
   dump += ('\n%04x: ' % addr)
   slice = ''
  dump += ('%02x ' % ord(byte))
  slice += byte
  addr += 1
 remainder = (addr % 16)
 if (remainder != 0):
  dump += (('   ' * (16 - remainder)) + ' ')
 for char in slice:
  if ((ord(char) >= 32) and (ord(char) <= 126)):
   dump += char
  else:
   dump += '.'
 return (dump + '\n')

def s_hex_dump ( data , addr = 0 ) : dump = slice = '' for byte in data : if ( ( addr % 16 ) == 0 ) : dump += ' ' for char in slice : if ( ( ord ( char ) >= 32 ) and ( ord ( char ) <= 126 ) ) : dump += char else : dump += '.' dump += ( '\n%04x: ' % addr ) slice = '' dump += ( '%02x ' % ord ( byte ) ) slice += byte addr += 1 remainder = ( addr % 16 ) if ( remainder != 0 ) : dump += ( ( '   ' * ( 16 - remainder ) ) + ' ' ) for char in slice : if ( ( ord ( char ) >= 32 ) and ( ord ( char ) <= 126 ) ) : dump += char else : dump += '.' return ( dump + '\n' )
return the hex dump of the supplied data starting at the offset address specified .