The wikipedia article actually links to an excellent tutorial (by X-N20) written in C that walks you through the Maths and provides C implementations on the go, which is quite useful for understanding the process. I'd also recommend reading up on finite field arithmetic.
Serpent and Twofish, having missed out on the AES title, aren't so well documented around the internet. Remember though that each provides reference implementations.
Actually implementing them yourself will require study of their respective papers and probably the reference source code.
Note that your 20 billion comments all relate to the fact that the interface NIST specified for AES was that each cipher provide a 128-bit (16 byte) input block and one of 128-bit, 192-bit and 256-bit key blocks.
In order to securely encrypt in such a way as to resist cryptanalysis properly, you need some careful work. For example, what if your last block is missing a few bytes needed? How do you pad securely? Similarly, depending on the intended usage there are other schemes, particularly for large repetitive data, designed to resist cryptanalysis where you know that the encrypted data likely contains say the contents of c:\windows
. What the commentors are trying to get at is that for any real world usage, to remain secure, these things need consideration.
Edit Since another question has cropped up on this topic, here's a few links:
- Brian Gladman's ASM/C code for various crypto-algorithms including AES, SHA and Serpent.
- OpenSSL's AES code in their CVS. See also DES. They don't implement Serpent. You might also want to look at the rest of their code under
crypto
.
- Crypto++. If you can use C++ and are only an end-user of crypto, then You Need This Library (tm). There are algorithms in there I've never heard of. Their SVN trunk.
- libgcrypt provides a whole suite of cryptographic functions for
gpg
. Specifically, if you're after AES, you might not find it in here, but you will find camellia and serpent.