class ref name: DES_crypt_o
class name: DES_crypt
category-group: security
layer: 2
header file: z_crypt.h
libraries: libz00.lib libz01.lib libz02.lib synopsis.
DES_crypt_o is a straightforward symmetric block cipher. Perhaps the most famous encryptor of all time, it is now considered obsolete and both hardware and software has been constructed that can crack it in a fairly short time. DES has been commonly described as a 56-bit key algorithm. This does mean that that the password should be 7 characters long. It actually needs to be 64 characters long. Out of that 64-byte string, 56 will actually be used internally (distilling down to 28 + 28 = 56 bits, in the C & D arrays internally). Also, DES does not work on block sizes under 64 bytes. Vettrasoft has constructed a work-around allowing you to encrypt any size block, but the resultant encrypted short block is not true DES). member functions (primary)
DES_crypt_o()
SIGNATURE: DES_crypt_o ()
SYNOPSIS: creates a a new (DES_crypt) encryption object.
DES_crypt_o(DES_crypt_o)
SIGNATURE: DES_crypt_o (const DES_crypt_o &that)
SYNOPSIS:
creates a a new (DES_crypt) encryption object. the password for the new object will be the same as for the copied object ("that").
operator = (DES_crypt_o)
SIGNATURE: const DES_crypt_o &operator = (const DES_crypt_o &that)
SYNOPSIS:
copies the DES encryption object into the current encryption object. The password for the current object will be the same as for the copied object ("that").
destructor
SIGNATURE: ~DES_crypt_o ()
SYNOPSIS: virtual destructor. The instance settings are reset (password is reset to nothing).
input_chunksize()
SIGNATURE: size_t input_chunksize (int *pi = NULL) const
SYNOPSIS:
returns the value of the input string's "chunk size" that is required by this algorithm (see discuession on security group main page), in bytes. The size of the input block must be a multiple of this value. For DES, this value is 64.
output_chunksize()
SIGNATURE: size_t output_chunksize (int *pi = NULL) const
SYNOPSIS:
returns the value of the output string's "chunk size". (see discuession on security group main page). This value indicates whether the encrypted data is the same length as the clear-text input, or expanded. For instance, if "input chunk size" = 16 and "output chunk size" = 32, the resultant encrypted data is twice as long as the input data.
For DES, output chunk size is always the same as the input chunk size (64 bytes).
clone()
SIGNATURE: crypto_o *clone () const
SYNOPSIS: creates a copy of the current object and returns a pointer to the newly created object.
set_key()
SIGNATURE: int set_key (const string_o &s, int *pi = NULL)
SYNOPSIS: sets the password. This function must be invoked prior to any encryption or decryption.
PARAMETERSencrypt()
- s: the password. Must be at least 64 bytes long.
- pi: [optional] error indicator [output] variable. Values:
0: operation successful
zcrypERR_BADKEY: invalid key size
SIGNATURE: int encrypt (const string_o &si, string_o &so, size_t *nb)
SYNOPSIS: encrypts the string "si". Result is put into output variable "so".
decrypt()
SIGNATURE: int decrypt (const string_o &si, string_o &so, size_t *nb)
SYNOPSIS: decrypts ciphered data in "si". resultant decrypted data is put into "so". The converse of encrypt().