ice_key Class Reference

This class provides ICE encryption. More...

#include <ice_key.h>

Inheritance diagram for ice_key:

Inheritance graph
[legend]
Collaboration diagram for ice_key:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ice_key (int blocks, bool randomize=true)
 the number "blocks" specifies the number of blocks in the key.
virtual ~ice_key ()
 IMPLEMENT_CLASS_NAME ("ice_key")
bool set (const byte_array &key)
 sets the key schedule of an ICE key.
bool encrypt (const byte_array &plain_text, byte_array &cipher_text) const
 encrypt a block of data with the given ICE key.
bool decrypt (const byte_array &cipher_text, byte_array &plain_text) const
 decrypt a block of data with the given ICE key.
int key_size () const
 returns the key size in bytes.
int blocks () const
 returns the number of blocks in the key.
int block_size () const
 returns the block size in bytes.

Detailed Description

This class provides ICE encryption.

This supports key based encryption similar to DES, but without some of the limitations and flaws.

Definition at line 32 of file ice_key.h.


Constructor & Destructor Documentation

ice_key::ice_key ( int  blocks,
bool  randomize = true 
)

the number "blocks" specifies the number of blocks in the key.

a block is composed of block_size() bytes (which is currently eight, and will probably continue to be such). thus, for three blocks, the key size must be twenty-four bytes. if "randomize" is true, then any chunk of the bytes to be encoded that are not a multiple of eight are padded with random bytes; otherwise, they are padded with zero bytes.

Definition at line 81 of file ice_key.cpp.

ice_key::~ice_key (  )  [virtual]

Definition at line 93 of file ice_key.cpp.

References WHACK().


Member Function Documentation

ice_key::IMPLEMENT_CLASS_NAME ( "ice_key"   ) 

bool ice_key::set ( const byte_array key  ) 

sets the key schedule of an ICE key.

true is returned if the "key" was successfully used. it can fail if its length is not 8 times the number of blocks set in the constructor.

Definition at line 361 of file ice_key.cpp.

References FUNCDEF, array< contents >::length(), and LOG.

Referenced by main(), and secret_string::secret_string().

bool ice_key::encrypt ( const byte_array plain_text,
byte_array cipher_text 
) const

encrypt a block of data with the given ICE key.

true is returned on success. reasons for failure would include not setting the key.

Definition at line 233 of file ice_key.cpp.

References chaos::inclusive(), array< contents >::length(), memory_assign(), array< contents >::overwrite(), and array< contents >::reset().

Referenced by secret_string::encrypt_string(), and main().

bool ice_key::decrypt ( const byte_array cipher_text,
byte_array plain_text 
) const

decrypt a block of data with the given ICE key.

true is returned on success. reasons for failure would include not setting the key.

Definition at line 261 of file ice_key.cpp.

References array< contents >::length(), and array< contents >::reset().

Referenced by secret_string::decrypt_string(), and main().

int ice_key::key_size (  )  const [inline]

returns the key size in bytes.

Definition at line 63 of file ice_key.h.

int ice_key::blocks (  )  const [inline]

returns the number of blocks in the key.

Definition at line 65 of file ice_key.h.

int ice_key::block_size (  )  const [inline]

returns the block size in bytes.

Definition at line 67 of file ice_key.h.


The documentation for this class was generated from the following files:
Generated on Fri Aug 29 04:30:32 2008 for HOOPLE Libraries by  doxygen 1.5.1