I am on Mac OS X 10.8.2, running a compiled copy of xxd v1.10 (source code) as well as the copy of xxd that comes preinstalled on OS X.
I am trying to generate a Base64-encoded SHA1 signature via a chain of piped commands in Terminal.
Normally I would do something like the following:
$ echo "foo" | openssl sha1 | xxd -p -r | base64 - > foo_sha1_signature
The file foo_sha1_signature normally contains a Base64-encoded SHA1 hash of the string foo.
The problem is that xxd -p -r does not return any data, so the file foo_sha1_signature is empty.
If I split the commands up to look at the output from xxd -r, I get a result (as printed below):
$ echo "foo" | openssl sha1 | xxd -p | xxd -r
7b36c94bcdf32bee$
But if I pipe standard output to a file, the file is empty:
$ echo "foo" | openssl sha1 | xxd -p | xxd -r > foo_sha1_bytes
$ ls -al foo_sha1_bytes 
-rw-r--r--  1 alexpreynolds  staff  0 Jan  2 23:02 foo_sha1_bytes
If I try piping standard error, the standard output shows the bytes and the file is still empty:
$ echo "foo" | openssl sha1 | xxd -p | xxd -r 2> foo_sha1_bytes
7b36c94bcdf32bee$
Finally, if I do all this on Linux, xxd works as expected (I get the signature in a file). So this seems to be a bug with how xxd works in OS X 10.8.2.
Is there an open-source alternative to xxd which works on Mac OS X and sends a byte-representation of standard input to standard output?