[dev] Horde_Cipher et al;

Mike Cochrane mike at graftonhall.co.nz
Sat Jul 26 17:09:03 PDT 2003


> ----- Message from davey at its-explosive.net ---------
> >
> Then in the light of this, we have a choice of code duplication or
> keeping this as one package. (or perhaps a Crypt_Base class (or
> something like this) which contains this stuff for all of the encryption
> stand-alone packages to use? sounds like a good idea to me actually...)
>

Quick lesson in how blockmode ciphers such as rc4, gost, cast128, blowfish,
basically all the common ones we see.

At these ciphers can do is encrypt pieces of data of a fixed length, in the case
of all the ones i listed, 8 bytes long. No short, no longer. That's how the
ciphers are designed.

The blockmodes handle how to combine these 8 byte blocks into something that
allows you to encrypt any length pieces of data. eg Cipher Block Chaining (CBC)
just breaks the data into 8 byte chucks, encrypts them and outputs them. Other
block modes do this in more secure, or different ways that are appropriate in
different situations such as when the total length of the data is not known
ahead of time.

There is no reason to seperate the two packages, anyone who is using the ciphers
alone will need to implement their own blockmodes and anyone using blockmodes
alone will need to implement their own cipher. Pretty silly really.

All the cipher classes except the Rc4 encryption have the same dependancies, so
there is no reason that all ciphers can't be installed in one package that I
can see.

- Mike :-)



More information about the dev mailing list