Article 42686 of alt.security:
A few months ago I had the bright idea of defining a C++ virtual base
class for block ciphers.

I came up with the following ...

class CryptKey {
    public:
	virtual int		blockSize() const = 0;
	virtual int		keySize() const = 0;

	virtual void		set(const unsigned char *key) = 0;

	virtual unsigned char	*encrypt(const unsigned char *ptext,
					unsigned char *ctext) const = 0;

	virtual unsigned char	*decrypt(const unsigned char *ctext,
					unsigned char *ptext) const = 0;
};


Any comments?

Anyway, I have modified the ICE encryption algorithm accordingly.
Although class IceKey doesn't actually inherit from this base class,
it could, since the member functions are the same.

Actually, the only change to the ICE implementation was to add the
keySize() and blockSize() functions (and blockSize always returns 8),
so if you have an old version of ICE there is no urgent need to upgrade.

Download this, plus Java and ANSI-C versions of ICE, from

	http://www.cs.mu.oz.au/~mkwan/ice


mkwan