FW: First Attempt at Crypto Library

Andrew J Bromage ajb@spamcop.net
Thu, 24 Apr 2003 11:01:17 +1000


G'day all.

On Wed, Apr 23, 2003 at 06:08:11PM +1000, I wrote:

> Codec.Encryption specifies what the module is for, not how it is used.
> Presumably there are going to be some type classes somewhere which
> specify whether it is a BinarySymmetricCipher like TripleDES or
> TextSymmetricCipher like FourWheelNavalEnigma.

My bad.  DES is not even a codec.

A cipher is an algorithm for turning an n-bit block into another n-bit
(and back again) block using an m-bit key.  It does not cover encoding
messages longer or shorter than an n-bit block.  At best it's a "codec"
for a certain fixed-size binary object where the size depends, in
general, on the algorithm.

This table may help clarify the thinking:

			| Algorithm	| Codec		| Format
	----------------+---------------+---------------+----------------
	 Cipher		| DES		| CBC-DES	| SSL
	 MAC		| SHA-1		| HMAC-SHA-96	| SNMPv3
	 Text compress	| LZ77		| Deflate	| GZip
	 Image compress	| DCT		| JPEG		| JFIF

My copy of OpenSSL, for example, supports at least nine "codecs"
based on single-strength DES.

Cheers,
Andrew Bromage