Lesson two
hd(1)
is your friend.
elegua% echo hello | hexdump -v -e '/1 "%02X "'
68 65 6C 6C 6F 0A
elegua% hd -n 32 example
00000000 05 02 01 01 54 00 75 02 56 00 80 02 28 00 2d 00 |....T.u.V...(.-.|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
elegua% hd -s 17 -n 16 example
00000011 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
elegua% hd -s 12 -n 10 example
0000000c 28 00 2d 00 00 00 00 00 00 00 |(.-.......|
In this way you can read any given file offset you need to, to see what's wrong where (like in the case of data being too short).
Note: hd
is an alternate binary name for hexdump