[X-Unix] Problem with xxd tools

Hudson Barton hhbv at highwinds.com
Sun May 29 21:11:44 PDT 2005


Hello, I wonder if anyone can help me fix this little problem.

I'm using the "XXD" tools for hexing and unhexing the result of 
encryptions produced by the "openssl" commands.  I'm using a 
Macintosh G4 with Tiger.  The environment is shell scripts 
(Applescript).

The Encrpytion process is... [Plaintext ==>> Encryption  ==>> Hexed 
String].  Then the reverse is...  [Hexed String  ==>> Decryption ==>> 
Plaintext].

When I use XXD, the encryption result produced by openssl (a string) 
is usually different (unpredictably) after being hexed and unhexed by 
XXD.  The error causes my decryption to fail.

Specifically, the problem is that the input string for XXD almost 
always contains ASCII character 10 (a line feed) in one or more 
places, and XXD often (or always - ????) returns ASCII character 13 
instead (a carriage return) when unhexing.  I don't think there is 
any way for me to work around this problem.  XXD needs to return 
exactly what it started with.

To recap, the original text (in file "fin") contains one or more 
incidents of ascii character 10==>>

The relevant lines of my code are:
Hexing:  	do shell script "xxd  -p -u  -c 20  " & fin
Unhexing:  	do shell script "xxd -r  -p -u -c 20 " & fin

===>>> result contains ascii character 13 instead of ascii character 10

Suggestions?


H.


More information about the X-Unix mailing list