[X-Unix] Problem with xxd tools
Eugene
list-themacintoshguy at fsck.net
Mon May 30 00:25:38 PDT 2005
On Sun, May 29, 2005 at 11:11:44PM CDT, Hudson Barton <hhbv at highwinds.com> wrote:
:
: 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?
I'm not familiar with xxd, but I did the following with a JPEG file:
$ xxd blah.jpg | xxd -r > blah2.jpg
$ diff blah.jpg blah2.jpg && echo "identical"
identical
--
Eugene
http://www.coxar.pwp.blueyonder.co.uk/
More information about the X-Unix
mailing list