Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcryptographichash.cpp File Reference

(96740ea3fed8a7837dc282135661723858fff198)

#include <qcryptographichash.h>
#include <qmessageauthenticationcode.h>
#include <qiodevice.h>
#include <qmutex.h>
#include <qvarlengtharray.h>
#include <private/qlocking_p.h>
#include <array>
#include <climits>
#include <numeric>
#include "../../3rdparty/sha1/sha1.cpp"
#include "../../3rdparty/rfc6234/sha.h"
#include "../../3rdparty/md5/md5.h"
#include "../../3rdparty/md5/md5.cpp"
#include "../../3rdparty/md4/md4.h"
#include "../../3rdparty/md4/md4.cpp"
#include "../../3rdparty/sha3/KeccakSponge.c"
#include "../../3rdparty/sha3/KeccakNISTInterface.c"
#include "../../3rdparty/sha3/KeccakF-1600-opt32.c"
#include "../../3rdparty/rfc6234/sha224-256.c"
#include "../../3rdparty/rfc6234/sha384-512.c"
#include "qtcore-config_p.h"
#include "../../3rdparty/blake2/src/blake2b-ref.c"
#include "../../3rdparty/blake2/src/blake2s-ref.c"
#include "moc_qcryptographichash.cpp"
+ Include dependency graph for qcryptographichash.cpp:

Go to the source code of this file.

Classes

class  QSmallByteArray< N >
 
class  QCryptographicHashPrivate
 
union  QCryptographicHashPrivate::State
 
class  QMessageAuthenticationCodePrivate
 

Macros

#define CASE(Enum, Size)
 

Typedefs

typedef unsigned char BitSequence
 
typedef unsigned long long DataLength
 
typedef spongeState hashState
 
typedef spongeState SHA3Context
 
typedef HashReturn SHA3Init(hashState *state, int hashbitlen)
 
typedef HashReturn SHA3Update(hashState *state, const BitSequence *data, DataLength databitlen)
 
typedef HashReturn SHA3Final(hashState *state, BitSequence *hashval)
 
using HashResult = QSmallByteArray<maxHashLength()>
 
using HashBlock = QSmallByteArray<maxHashBlockSize()>
 

Enumerations

enum  HashReturn { SUCCESS = 0 , FAIL = 1 , BAD_HASHLEN = 2 }
 

Functions

static int SHA224_256AddLength (SHA256Context *context, unsigned int length)
 
static int SHA384_512AddLength (SHA512Context *context, unsigned int length)
 
static constexpr int hashLengthInternal (QCryptographicHash::Algorithm method) noexcept
 
static constexpr int maxHashLength ()
 
static constexpr int qt_hash_block_size (QCryptographicHash::Algorithm method)
 
constexpr int maxHashBlockSize ()
 
constexpr int minHashBlockSize ()
 
constexpr int gcdHashBlockSize ()
 
static HashBlock xored (const HashBlock &block, quint8 val) noexcept
 

Variables

static Q_CONSTINIT SHA3Init *const sha3Init = Init
 
static Q_CONSTINIT SHA3Update *const sha3Update = Update
 
static Q_CONSTINIT SHA3Final *const sha3Final = Final
 

Macro Definition Documentation

◆ CASE

#define CASE ( Enum,
Size )
Value:
case QCryptographicHash:: Enum : \
return Size \
/*end*/

Typedef Documentation

◆ BitSequence

typedef unsigned char BitSequence

Definition at line 36 of file qcryptographichash.cpp.

◆ DataLength

typedef unsigned long long DataLength

Definition at line 37 of file qcryptographichash.cpp.

◆ HashBlock

Definition at line 1323 of file qcryptographichash.cpp.

◆ HashResult

Definition at line 250 of file qcryptographichash.cpp.

◆ hashState

typedef spongeState hashState

Definition at line 45 of file qcryptographichash.cpp.

◆ SHA3Context

typedef spongeState SHA3Context

Definition at line 52 of file qcryptographichash.cpp.

◆ SHA3Final

typedef HashReturn SHA3Final(hashState *state, BitSequence *hashval)

Definition at line 55 of file qcryptographichash.cpp.

◆ SHA3Init

typedef HashReturn SHA3Init(hashState *state, int hashbitlen)

Definition at line 53 of file qcryptographichash.cpp.

◆ SHA3Update

typedef HashReturn SHA3Update(hashState *state, const BitSequence *data, DataLength databitlen)

Definition at line 54 of file qcryptographichash.cpp.

Enumeration Type Documentation

◆ HashReturn

enum HashReturn
Enumerator
SUCCESS 
FAIL 
BAD_HASHLEN 

Definition at line 38 of file qcryptographichash.cpp.

Function Documentation

◆ gcdHashBlockSize()

constexpr int gcdHashBlockSize ( )
constexpr

Definition at line 1314 of file qcryptographichash.cpp.

References A, i, qt_hash_block_size(), and QCryptographicHashPrivate::result.

Referenced by xored().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hashLengthInternal()

◆ maxHashBlockSize()

constexpr int maxHashBlockSize ( )
constexpr

Definition at line 1294 of file qcryptographichash.cpp.

References A, i, qt_hash_block_size(), and QCryptographicHashPrivate::result.

Referenced by xored().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maxHashLength()

static constexpr int maxHashLength ( )
staticconstexpr

Definition at line 241 of file qcryptographichash.cpp.

References A, hashLengthInternal(), and i.

+ Here is the call graph for this function:

◆ minHashBlockSize()

constexpr int minHashBlockSize ( )
constexpr

Definition at line 1304 of file qcryptographichash.cpp.

References A, i, qt_hash_block_size(), and QCryptographicHashPrivate::result.

Referenced by xored().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_hash_block_size()

◆ SHA224_256AddLength()

static int SHA224_256AddLength ( SHA256Context * context,
unsigned int length )
inlinestatic

Definition at line 97 of file qcryptographichash.cpp.

References context.

◆ SHA384_512AddLength()

static int SHA384_512AddLength ( SHA512Context * context,
unsigned int length )
inlinestatic

Definition at line 102 of file qcryptographichash.cpp.

References context.

◆ xored()

static HashBlock xored ( const HashBlock & block,
quint8 val )
staticnoexcept

Definition at line 1325 of file qcryptographichash.cpp.

References gcdHashBlockSize(), i, maxHashBlockSize(), minHashBlockSize(), Q_ASSERT, and QCryptographicHashPrivate::result.

Referenced by QMessageAuthenticationCodePrivate::finalizeUnchecked(), and QMessageAuthenticationCodePrivate::initMessageHash().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ sha3Final

Q_CONSTINIT SHA3Final* const sha3Final = Final
static

Definition at line 71 of file qcryptographichash.cpp.

Referenced by QCryptographicHashPrivate::State::sha3Finish().

◆ sha3Init

Q_CONSTINIT SHA3Init* const sha3Init = Init
static

Definition at line 69 of file qcryptographichash.cpp.

Referenced by QCryptographicHashPrivate::State::reset().

◆ sha3Update

Q_CONSTINIT SHA3Update* const sha3Update = Update
static