Sha1?

Dear lazyweb,

what library, that every decent GNU-loving person has installed (in the range of libm, libz, etc.), could do sha1 encoding for me? I hate to ship sha1.c or sha1sum.c in every single package I make. Reason is that the output of system(“sha1sum $file”); appears to be shell-dependent, and that breaks my firmware-loader for several people. Using a C library/function would fix that.

And whoa!, apparently an airplane just crashed into a building just near where I work and live.

This entry was posted in General. Bookmark the permalink.

14 Responses to Sha1?

  1. cartman says:

    Use OpenSSL ?

    [~]> openssl sha1 psi-0.11-beta3.tar.bz2
    SHA1(psi-0.11-beta3.tar.bz2)= aaaf8260fd622bb7707ff2318d71e22cc0d471fc

  2. I need something in C. :-).

  3. Luis says:

    Yeah, we could see the helicopters circling from my place. When are we going to get together for a beer, anyway… 🙂

  4. cartman says:

    Too obvious I know but this might help: hxxp://tinyurl.com/hyfyt

  5. cartman: I linked those in my blog. So here’s the thing: I’d like to not copy some public-domain code, but instead actually reuse an already existing system library that implements it. Do those exist? I noticed gcrypt when doing a grep -i sha1 on my /usr/include, never heard of before. I’m hoping for someone’s epiphany.

    Luis: let’s get together this weekend or so, I can come to Columbia, I need to visit another friend there as well.

  6. Martin says:

    OpenSSL was already mentioned, here are the sha-functions exported by openssl:
    http://www.openssl.org/docs/crypto/sha.html

  7. gamehack says:

    Use OpenSSL linking with the -lcrypto switch.

  8. cartman says:

    Well OpenSSL already implements it, thats what I am trying to say 😉

  9. Ah, OK, so I didn’t know openssl exported a C API for this kind of stuff. Thanks guys, I’ll look into it.

  10. Anonymous says:

    Think twice before using OpenSSL in GPLed programs:

    http://www.gnome.org/~markmc/openssl-and-the-gpl.html

  11. Tim Mueller says:

    GNet provides this too. Not exactly as common as libz or libm though I’m afraid, but at least LGPL.

  12. Rob Bradford says:

    Uhm. libgcrypt does it and I think i might even have a piece of code around here that does it.

  13. Awesome, thanks Rob, this is what I was looking for. :-).

Comments are closed.