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.

Commentary

Leave a response »

  1. 1. October 12th, 2006

    Use OpenSSL ?

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

  2. 2. October 12th, 2006

    I need something in C. :-) .

  3. 3. October 12th, 2006

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

  4. 4. October 12th, 2006

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

  5. 5. October 12th, 2006

    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. 6. October 12th, 2006

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

    Martin
  7. 7. October 12th, 2006

    Use OpenSSL linking with the -lcrypto switch.

  8. 8. October 12th, 2006

    Well OpenSSL already implements it, thats what I am trying to say ;-)

  9. 9. October 12th, 2006

    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. 10. October 12th, 2006

    Think twice before using OpenSSL in GPLed programs:

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

    Anonymous
  11. 11. October 12th, 2006

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

    Tim Mueller
  12. 12. October 13th, 2006

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

  13. 13. October 13th, 2006
  14. 14. October 17th, 2006

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

Trackbacks

Leave a comment, a trackback from your own site or subscribe to an RSS feed for this entry. Trackback URL for this entry Comments feed for this entry

Leave a response

Leave a URL

Preview