ice-doc-C++.html
e3004805cd295faf3c3e9ff4587c261440c40c632918ae1fb16b461efbedabcb
<HTML>
<HEAD><TITLE>The C++ ICE Encryption Class</TITLE></HEAD>
<BODY BGCOLOR="#d8d8d8" TEXT="#000080" LINK="#0000FF">
<H1>The C++ ICE Encryption Class</H1>
<H3>Synopsis</H3>
<DL>
<DD> <CODE>#include <IceKey.H></CODE>
<BR><BR>
<DD> <CODE>IceKey::IceKey (int level)</CODE>
<BR><BR>
<DD> <CODE>IceKey::~IceKey ();</CODE>
<BR><BR>
<DD> <CODE>void IceKey::set (const unsigned char *key);</CODE>
<BR><BR>
<DD> <CODE>unsigned char *IceKey::encrypt (const unsigned char *plaintext,
unsigned char *ciphertext) const;</CODE>
<BR><BR>
<DD> <CODE>unsigned char *IceKey::decrypt (const unsigned char *ciphertext,
unsigned char *plaintext) const;</CODE>
<BR><BR>
<DD> <CODE>int IceKey::keySize () const;</CODE>
<BR><BR>
<DD> <CODE>int IceKey::blockSize () const;</CODE>
</DL>
<H3>Description</H3>
<P>
The <EM>IceKey</EM> class is used for encrypting and decrypting 64-bit
blocks of data with the ICE (Information Concealment Engine) encryption
algorithm. </P>
<P>
The constructor creates a new <CODE>IceKey</CODE> object that can be used
to encrypt and decrypt data. The <EM>level</EM> of encryption determines
the size of the key, and hence its speed. Level 0 uses the Thin-ICE
variant, which is an 8-round cipher taking an 8-byte key. This is the
fastest option, and is generally considered to be at least as secure
as DES, although it is not yet certain whether it is as secure as its
key size. </P>
<P>
For levels <EM>n</EM> greater than zero, a 16<EM>n</EM>-round cipher is
used, taking 8<EM>n</EM>-byte keys. Although not as fast as level 0,
these are very very secure. </P>
<P>
Before an <CODE>IceKey</CODE> can be used to encrypt data, its key
schedule must be set with the <CODE>set()</CODE> member function. The
length of the key required is determined by the level, as described above. </P>
<P>
The member functions <CODE>encrypt()</CODE> and <CODE>decrypt()</CODE>
encrypt and decrypt respectively data in blocks of eight chracters,
using the specified key. They return a pointer to the resulting
ciphertext/plaintext. </P>
<P>
Two functions <CODE>keySize()</CODE> and <CODE>blockSize()</CODE>
are provided which return the key and block size
respectively, measured in bytes. The key size is determined by
the level, while the block size is always 8. </P>
<P>
The destructor zeroes out and frees up all memory associated with the key. </P>
<HR>
<DIV ALIGN=RIGHT>
<FONT SIZE=-1>
Document written by Matthew Kwan, 25 March 1997 <BR>
Please send any comments or corrections to
<A HREF="mailto:mkwan@darkside.com.au">mkwan@darkside.com.au</A>
</FONT>
</DIV>
</BODY>
</HTML>