Here is a random list of open source software I regularely use and like. This list is geared toward C/C++, since that is what I mainly code in.
If you need SHA1, and nothing more, simply copy the code from RFC 3174.
You can find a lot of code with Google's Codesearch. Make sure you don't violate the open source licenses when copying the code.
When it comes to C, there is only one book you need: The C programming language by K&R. You're guaranteed to find something in this innocent-looking book that you thought you knew about C.
If you're interested in knowing how people develop hacks (and cracks), be sure to read phrack. You'll become a better programmer by trying to understand some of those articles, and then you'll see how you can program more securely as well.
The obfuscated C contest contains the most insanely brilliant and hilarious code you'll ever see.
Get The C++ programming language for reference. You should supply this with a guide to STL usage; many recommend Josutti's STL book.
To avoid blowing your leg off, read the Effective C++ series by Scott Meyers.
There is also the excellent C++ FAQ online. But don't buy their book, the online version is much more humorous.
If you are determined to go over the top with C++, you need Modern C++ Design by Andrei Alexandrescu.
Get UNIX Network Programming by W. Richard Stevens.
See http://people.redhat.com/drepper/dsohowto.pdf
If you don't read the source of the stuff you use, start doing it right now!
Recently I went through the git source by Linus Torvalds. Beginning with the first release, I read my way up through the various versions. This gave me a good impression of how a master programmer pieces together a big project from scratch. Highly recommended.
Some ridiculous people claim they don't need to know anything about assembly, but that is, of course, pure nonsense. :)
You should at the bare minimum step-debug your code with a disassembler to see what is actually going on. Prepare to be amazed how dumb your compiler can be.