Wednesday, June 25, 2008

sha1sum on Mac OSX

Getting ready to assemble the Firefox 3 CD and came upon the glitch that Mac OS X doesn't provide sha1sum tools. Quick Google search turned up a great comment on this blog post which suggests using openssl and by putting alias sha1sum="openssl dgst -sha1" in my .profile I can now do sha1sum $app_name.iso to my heart's content.

The Firefox 3 CD will now have all the supported locales on it, which is a step up from the Firefox 2 CD. Look for it in a Mozilla Store near you.

2 comments:

preed said...

Lamentably, openssl has a format that's different than what sha1sum will give you (if you care because you're parsing it, or having other people parse it.

That's what this insanity is all about, BTW:

http://mxr.mozilla.org/mozilla/source/tools/release/MozBuild/Util.pm#316

Atul said...

No idea if this gets around preed's lamentation, but OSX does come with Python, which has sha hashing functionality in its standard library. It's pretty primitive, but something like this might work:

alias sha1sum="python -c 'import sha, sys; print sha.new(open(sys.argv[1]).read()).hexdigest()'"