MuldeR's Utilities for Qt: include/MUtils/Hash.h File Reference

MuldeR's Utilities for Qt MUtilities

Classes | Namespaces | Functions | Variables
Hash.h File Reference

This file contains function for cryptographic hash computation. More...

`#include <MUtils/Global.h>`
`#include <QByteArray>`
`#include <QFile>`

Go to the source code of this file.

## Classes
class | MUtils::Hash::Hash
| This abstract class specifies the generic interface for all support hash algorithms. More...

## Namespaces
| MUtils
| Global MUtils namespace.

## Functions
MUTILS_API Hash * | MUtils::Hash::create (const quint16 &hashId, const char *const key=NULL)
| Create instance of a hash function. More...

## Variables
static const quint16 | MUtils::Hash::HASH_BLAKE2_512 = 0x0000U
| Hash algorithm identifier. More...
static const quint16 | MUtils::Hash::HASH_KECCAK_224 = 0x0100U
| Hash algorithm identifier. More...
static const quint16 | MUtils::Hash::HASH_KECCAK_256 = 0x0101U
| Hash algorithm identifier. More...
static const quint16 | MUtils::Hash::HASH_KECCAK_384 = 0x0102U
| Hash algorithm identifier. More...
static const quint16 | MUtils::Hash::HASH_KECCAK_512 = 0x0103U
| Hash algorithm identifier. More...

## Detailed Description

This file contains function for cryptographic hash computation.

Call the MUtils::Hash::create() function to create an instance of the desired hash function. All Hash functions implement the MUtils::Hash::Hash interface.

## Function Documentation

## § create()

MUTILS_API Hash* MUtils::Hash::create | ( | const quint16 & | hashId,
|  | const char *const | key = `NULL`
| ) |  |

Create instance of a hash function.

This function is used to create a new instance of the desired hash function. All Hash functions implement the MUtils::Hash::Hash interface. The caller is responsible for destroying the returned MUtils::Hash::Hash object.

Parameters

  hashId | Specifies the desired hash function. This must be a valid hash algorithm identifier, as defined in the `Hash.h` header file.
  key | Specifies on optional key that is used to "seed" the hash function. If a key is given, it must be a NULL-terminated string of appropriate length. If set to `NULL`, the optional seeding is skipped.

Returns
  Returns a pointer to a new MUtils::Hash::Hash object that implements the desired hash function. The function throws if an invalid algorithm identifier was specified!

## Variable Documentation

## § HASH_BLAKE2_512

const quint16 MUtils::Hash::HASH_BLAKE2_512 = 0x0000U
| static

Hash algorithm identifier.

Use BLAKE2 hash algorithm, with a length of 512-Bit.

## § HASH_KECCAK_224

const quint16 MUtils::Hash::HASH_KECCAK_224 = 0x0100U
| static

Hash algorithm identifier.

Use Keccak (SHA-3) hash algorithm, with a length of 224-Bit.

## § HASH_KECCAK_256

const quint16 MUtils::Hash::HASH_KECCAK_256 = 0x0101U
| static

Hash algorithm identifier.

Use Keccak (SHA-3) hash algorithm, with a length of 256-Bit.

## § HASH_KECCAK_384

const quint16 MUtils::Hash::HASH_KECCAK_384 = 0x0102U
| static

Hash algorithm identifier.

Use Keccak (SHA-3) hash algorithm, with a length of 384-Bit.

## § HASH_KECCAK_512

const quint16 MUtils::Hash::HASH_KECCAK_512 = 0x0103U
| static

Hash algorithm identifier.

Use Keccak (SHA-3) hash algorithm, with a length of 512-Bit.