Rudiments
Public Member Functions | List of all members
des Class Reference

Inherits hash.

Public Member Functions

 des ()
 
 ~des ()
 
size_t getSaltSize ()
 
const byte_t * getHash ()
 
uint64_t getHashSize ()
 
bool getNeedsMutex ()
 
void setMutex (threadmutex *mtx)
 
- Public Member Functions inherited from hash
 hash ()
 
virtual ~hash ()
 
virtual bool setSalt (const byte_t *salt, size_t size)
 
virtual const byte_t * getSalt ()
 
virtual bool append (const byte_t *data, uint32_t size)
 
virtual hasherror_t getError ()
 
virtual bool clear ()
 
virtual bool reset ()
 
- Public Member Functions inherited from object
virtual ~object ()
 

Detailed Description

The des class provides the hash method commonly used on unix and unix-like platforms for for password encryption.

Constructor & Destructor Documentation

◆ des()

des::des ( )

Creates an intance of the des class.

◆ ~des()

des::~des ( )

Deletes this instance of the des class.

Member Function Documentation

◆ getHash()

const byte_t* des::getHash ( )
virtual

Interprets the current data as unencrypted. Encrypts current data using the des algorithm, and the initilization vector as the "salt" (which should be a 2 character string from the set [a-zA-Z0-9./]. Returns the encrypted data on success or NULL if an error occurred.

Note that since des is typically used to encrypt passwords, and that the encrypted data that results from this type of encryption is always printable ascii, this method NULL-terminates the encrypted data, and the result can be interpreted as a NULL-terminated string.

Note that the encrypted data returned will be an empty string if no data has been appended yet.

Implements hash.

◆ getHashSize()

uint64_t des::getHashSize ( )
virtual

Returns the number of bytes of encrypted data, not including the NULL-terminator.

Note that since the encrypted data that results from this type of encryption is always printable ascii, this size is equivalent to the string length.

Reimplemented from hash.

◆ getNeedsMutex()

bool des::getNeedsMutex ( )

If your system doesn't support a reentrany crypt function then this class needs a mutex to assure thread safety.

This method returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.

◆ getSaltSize()

size_t des::getSaltSize ( )
virtual

Returns the number of bytes in the salt.

Reimplemented from hash.

◆ setMutex()

void des::setMutex ( threadmutex mtx)

Allows you to supply a mutex is the class needs it. If your application is not multithreaded, then there is no need to supply a mutex.