binary
September 12, 2008 11:10 AM Subscribe
How do I look at each byte of a file in binary in XP?
There are so many hex editors where I can see the hex representation of each byte, but where can I get one where I can see it in binary? I'm not really even concerned about editing the file, just looking at it in binary form.
There are so many hex editors where I can see the hex representation of each byte, but where can I get one where I can see it in binary? I'm not really even concerned about editing the file, just looking at it in binary form.
Response by poster: Ideally, it would just be a text file that gives the binary representations of each byte in a file. Like a text file with mmmm would look like this:
01101101
01101101
01101101
01101101
posted by amsterdam63 at 11:36 AM on September 12, 2008
01101101
01101101
01101101
01101101
posted by amsterdam63 at 11:36 AM on September 12, 2008
The hex editor plugin to Notepad++ does this, but almost all hex editors should be able to do a binary display.
posted by demiurge at 11:55 AM on September 12, 2008
posted by demiurge at 11:55 AM on September 12, 2008
Do you have access to python?
import sys
for c in open(sys.argv[1], "rb").read():
bits = [(ord(c)>>bitpos) & 1 for bitpos in range(7,-1,-1)]
print "".join(map(str, bits))
posted by bonecrusher at 11:56 AM on September 12, 2008
import sys
for c in open(sys.argv[1], "rb").read():
bits = [(ord(c)>>bitpos) & 1 for bitpos in range(7,-1,-1)]
print "".join(map(str, bits))
posted by bonecrusher at 11:56 AM on September 12, 2008
OK - metafilter doesn't respect my indentation requests. Last two lines should be indented.
posted by bonecrusher at 11:57 AM on September 12, 2008
posted by bonecrusher at 11:57 AM on September 12, 2008
Indentation independent Python program.
import sys
for c in open(sys.argv[1], "rb").read(): print "".join(map(str, [(ord(c)>>bitpos) & 1 for bitpos in range(7,-1,-1)]))
posted by cmiller at 12:47 PM on September 12, 2008
import sys
for c in open(sys.argv[1], "rb").read(): print "".join(map(str, [(ord(c)>>bitpos) & 1 for bitpos in range(7,-1,-1)]))
posted by cmiller at 12:47 PM on September 12, 2008
This thread is closed to new comments.
For example, my hex editor of choice XVI32 has a Data Inspector window that shows various representations of a byte (including binary) when you click on a byte in the main window.
posted by burnmp3s at 11:25 AM on September 12, 2008 [1 favorite]