Qt 4.3: QCryptographicHash Class Reference

|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QCryptographicHash Class Reference
[QtCore module]

The QCryptographicHash class provides a way to generate cryptographic hashes. More...

     #include <QCryptographicHash>

Note: All the functions in this class are reentrant.

This class was introduced in Qt 4.3.

- List of all members, including inherited members

### Public Types

- enum Algorithm { Md4, Md5, Sha1 }

### Public Functions

- QCryptographicHash ( Algorithm method )
- ~QCryptographicHash ()
- void addData ( const char * data, int length )
- void addData ( const QByteArray & data )
- void reset ()
- QByteArray result () const

### Static Public Members

- QByteArray hash ( const QByteArray & data, Algorithm method )

## Detailed Description

The QCryptographicHash class provides a way to generate cryptographic hashes.

QCryptographicHash can be used to generate cryptographic hashes of binary or text data.

Currently Md4, Md5, and Sha1 are supported.

## Member Type Documentation

### enum QCryptographicHash::Algorithm

Constant | Value | Description
--- | --- | ---
`QCryptographicHash::Md4` | `0` | Generate an Md4 hash sum
`QCryptographicHash::Md5` | `1` | Generate an Md5 hash sum
`QCryptographicHash::Sha1` | `2` | Generate an Sha1 hash sum

## Member Function Documentation

### QCryptographicHash::QCryptographicHash ( Algorithm method )

Constructs an object that can be used to create a cryptographic hash from data using method.

### QCryptographicHash::~QCryptographicHash ()

Destroys the object.

### void QCryptographicHash::addData ( const char * data, int length )

Adds the first length chars of data to the cryptographic hash.

### void QCryptographicHash::addData ( const QByteArray & data )

This is an overloaded member function, provided for convenience.

/overload

### QByteArray QCryptographicHash::hash ( const QByteArray & data, Algorithm method ) `[static]`

Returns the hash of data using method.

### void QCryptographicHash::reset ()

Resets the object.

### QByteArray QCryptographicHash::result () const

Returns the final hash value.