Open the file as normal in vi
To enter hex mode:
:%!xxd
To exit hex mode:
:%!xxd -r