Thanks for the tip, Travis! I actually rewrote about this problem on my tech blog and used a similar solution:

http://solidstateraam.com/mac-os-x-replicating-md5sum-output-format/