How to? TPIPE /simple=61

samintz

Scott Mintz
May 20, 2008
1,533
21
Solon, OH, USA
I have a binary file that I want to reverse every 4 bytes.
E.g. 01 02 03 04 05 06 07 08 becomes 04 03 02 01 08 07 06 05

Looking at the description for TPIPE /Simple=61 it says:

61 – Swap UTF-32 word order
This filter swaps groups of 2-byte words.

Which looks like exactly what I want. However, the resulting file is 2 bytes longer and somewhere within the file the data gets messed up.
I am issuing this command:
Code:
tpipe /input=pka_fw.bin /output=pka_fw.le /simple=61

Is this a bug in tpipe or am I doing something wrong?
 
May 20, 2008
11,843
120
Syracuse, NY, USA
It works (blindly) on pretty simple stuff. But Rex is right. If characters aren't 4 bytes, it's really going to mess things up.

Code:
v:\> echo abcd | tpipe /simple=61
dcba
 

samintz

Scott Mintz
May 20, 2008
1,533
21
Solon, OH, USA
The input file is exactly 1000h bytes. So the multiple of 4 isn't the issue. It appears to treat 0x0D - the Mac EOL char - special and replaces it with 0x0d 0x0a. Since my input file has 2 0x0d bytes, the file grows by 2 bytes.
 

samintz

Scott Mintz
May 20, 2008
1,533
21
Solon, OH, USA
That worked! I used this command:
Code:
tpipe /input=pka_fw.bin /output=pka_fw.le /eol=4,3,65536 /simple=61
 

Similar threads