|  | Home · All Classes · Modules

# QCryptographicHash Class Reference
[QtCore module]

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

### Types

- enum Algorithm { Md4, Md5, Sha1 }

### Methods

- __init__ (self, Algorithm method)
- addData (self, str data)
- addData (self, QByteArray data)
- reset (self)
- QByteArray result (self)

### Static Methods

- QByteArray hash (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.

## Type Documentation

### 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

## Method Documentation

### QCryptographicHash.__init__ (self, Algorithm method)

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

### QCryptographicHash.addData (self, str data)

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

### QCryptographicHash.addData (self, QByteArray data)

This is an overloaded member function, provided for convenience.

/overload

### QByteArray QCryptographicHash.hash (QByteArray data, Algorithm method)

Returns the hash of data using method.

### QCryptographicHash.reset (self)

Resets the object.

### QByteArray QCryptographicHash.result (self)

Returns the final hash value.