Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? TPIPE /simple=61

samintz

Scott Mintz
May
1,582
27
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?
 
It appears to be related to embedded 0x0D values. There are 2 of them in this particular file.
 
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
 
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.
 
That worked! I used this command:
Code:
tpipe /input=pka_fw.bin /output=pka_fw.le /eol=4,3,65536 /simple=61
 

Similar threads

Back
Top