Start work on libdrew manual.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
hash.xml: add folds.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
hash.xml: use C, not C++ as the language.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
hash.xml: document info function.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Add Makefile for building the manual.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
rabbit: consolidate CounterUpdate and NextState.

Since these two functions are always called together, consolidating them makes
the code cleaner.  Combining the two loops together also provides better
performance (208 MiB/s v. 218 MiB/s).

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
rabbit: mark helper inline functions const.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
hc: generate large amounts of keystream at once.

Generating large amounts of keystream material at once (4096 bytes for HC128;
8192 for HC256) dramatically reduces the overhead required to generate keystream
bytes.  This increases the speed from 259 MiB/s to 481 MiB/s for HC128 and 235
MiB/s to 410 MiB/s for HC256.  It also causes a significant increase in memory
consumption per-context due to the large buffers needed.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
manual: add an introduction.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
doc: build a table of contents.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
arc4stir: separate out keystream generator.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Add ARC4Interleave.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
arc4interleave: use xor of two generators.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
include/util: implement xor_aligned in C.

The C++ XorAligned is useful in C as well, especially in the different mode
plugins, which are written in C.  Therefore, move the majority of the code to
util.h and simply make XorAligned a wrapper around it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
mode/ctr: implement encrypt_fast.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
include/util: add endianness Convert functions.

The Convert functions load or store a single word (of whatever size) from a
block of memory.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
include/util: use htonl and friends for Convert.

The Convert functions for BigEndian conversions now use htonl and friends for
efficiency reasons.  Glibc provides assembly versions of these in some cases,
and where it does not, it provides code that GCC can optimize into a single
instruction if that is available.  Presumably other systems provide similarly
optimized code.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
aes: use Convert functions.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
aes: use GetByte.

Besides being visually cleaner, GetByte also provides a very small performance
improvement.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
aes: use E::GetByte in key scheduling, too.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>