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.
Use OpenSSL ?
[~]> openssl sha1 psi-0.11-beta3.tar.bz2
SHA1(psi-0.11-beta3.tar.bz2)= aaaf8260fd622bb7707ff2318d71e22cc0d471fc
I need something in C. :-).
Yeah, we could see the helicopters circling from my place. When are we going to get together for a beer, anyway… 🙂
Too obvious I know but this might help: hxxp://tinyurl.com/hyfyt
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.
OpenSSL was already mentioned, here are the sha-functions exported by openssl:
http://www.openssl.org/docs/crypto/sha.html
Use OpenSSL linking with the -lcrypto switch.
Well OpenSSL already implements it, thats what I am trying to say 😉
Ah, OK, so I didn’t know openssl exported a C API for this kind of stuff. Thanks guys, I’ll look into it.
Think twice before using OpenSSL in GPLed programs:
http://www.gnome.org/~markmc/openssl-and-the-gpl.html
GNet provides this too. Not exactly as common as libz or libm though I’m afraid, but at least LGPL.
Uhm. libgcrypt does it and I think i might even have a piece of code around here that does it.
Here it is:
http://www.robster.org.uk/tmp/sha1sum-gcrypt.tar.gz
Awesome, thanks Rob, this is what I was looking for. :-).