[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Suggest a tool for decoding binary data



I've been working on homegrown backups for a while.  I like using
standard UNIX tools because the backups are usable on any *NIX system.
I'm about to tackle GPT partitioned disks, and want to decode the
label.

I need it because i like to take dd-style dumps of the partition info,
including the stuff at the end of the disk.  Since the label contains
info about variable areas (the two partition lists) I need to decode
these.

The data is little-endian, but I want my code to work on little- or
big-endian machines.  I want it to be a script -- nothing compiled.

I've figured out that on my little-endian machines, I can use bash
with something like
    otherlabel=$(($(dd if=label bs=1 skip=32 count=8 | od -An -t d8) ))
and I get the right answer, but only because the endianness of the
data and of my machine are the same.  I want something that will also
work on a big-endian machine, and I want it to be reasonably simple.

Any ideas?

-- 
Kevin O'Gorman

programmer, n. an organism that transmutes caffeine into software.
Please consider the environment before printing this email.


Reply to: