I've been tinkering with multiple hex editors but nothing really has worked.
What I'm looking for is a way to change a binary in actual binary (not in hex). This is purely for educational purposes and I know it's trivial to convert between both, but I wanted to be able to change the ones and zeroes just like I would do hex.
I've tried using vim with the %!xxd -b but then it won't work with %!xxd -r. I know how to convert the file into binary, but I'm looking for a way to dynamically change it in this format and being able to save it.
Better yet would be if I could find a way to actually create a binary by coding purely in actual binary.
Any help would be appreciated :D
vim
or gvim
should work for you directly, without the xxd
filter.
Open the file in (g)vim. Place your cursor on a character and type ga
to see its character code in the status line. To insert character NNN, place your cursor where you want it, go in insert mode and type Ctrl-v
and then the three digit decimal code value. Use Ctrl-v x HH
to enter the character by its hexadecimal code.
Make sure your terminal is not set to use UTF8, because in UTF8, typing Ctrl-v 128
will in fact insert c280
, the utf-8 encoding of character 128, instead of 80
.
LC_ALL=C vim binary-file
is the easiest way to make sure you're doing binary character based editing in vim, but that might do weird things if your terminal is utf-8.
LC_ALL=C gvim binary-file
should open a stand-alone window with proper display.
FYI, if you did want to work in utf-8, Ctrl-v u HHHH
is how to enter the Unicode character with Hex code point HHHH.