Using hexdump function instead of external command