Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcryptographichash.cpp File Reference

(b83e825fab16f83f86149ead78efb6ec3d2fa16d)

#include <qcryptographichash.h>
#include <qmessageauthenticationcode.h>
#include <QtCore/private/qsmallbytearray_p.h>
#include <qiodevice.h>
#include <qmutex.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  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 , SUCCESS = 0 ,
  FAIL = 1 , BAD_HASHLEN = 2
}
 
enum  HashReturn {
  SUCCESS = 0 , FAIL = 1 , BAD_HASHLEN = 2 , 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)
 
QT_WARNING_PUSH QT_WARNING_POP static QT_BEGIN_NAMESPACE 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*/
#define Size(name)

Typedef Documentation

◆ BitSequence

typedef unsigned char BitSequence

Definition at line 32 of file qcryptographichash.cpp.

◆ DataLength

typedef unsigned long long DataLength

Definition at line 33 of file qcryptographichash.cpp.

◆ HashBlock

◆ HashResult

◆ hashState

typedef spongeState hashState

Definition at line 41 of file qcryptographichash.cpp.

◆ SHA3Context

typedef spongeState SHA3Context

Definition at line 48 of file qcryptographichash.cpp.

◆ SHA3Final

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

Definition at line 51 of file qcryptographichash.cpp.

◆ SHA3Init

typedef HashReturn SHA3Init(hashState *state, int hashbitlen)

Definition at line 49 of file qcryptographichash.cpp.

◆ SHA3Update

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

Definition at line 50 of file qcryptographichash.cpp.

Enumeration Type Documentation

◆ HashReturn [1/2]

enum HashReturn
Enumerator
SUCCESS 
FAIL 
BAD_HASHLEN 
SUCCESS 
FAIL 
BAD_HASHLEN 

Definition at line 34 of file qcryptographichash.cpp.

◆ HashReturn [2/2]

enum HashReturn
Enumerator
SUCCESS 
FAIL 
BAD_HASHLEN 
SUCCESS 
FAIL 
BAD_HASHLEN 

Definition at line 34 of file qcryptographichash.cpp.

Function Documentation

◆ gcdHashBlockSize()

int gcdHashBlockSize ( )
constexpr

Definition at line 1294 of file qcryptographichash.cpp.

Referenced by xored().

+ Here is the caller graph for this function:

◆ hashLengthInternal()

QT_WARNING_PUSH QT_WARNING_POP static QT_BEGIN_NAMESPACE constexpr int hashLengthInternal ( QCryptographicHash::Algorithm method)
staticconstexprnoexcept

Definition at line 128 of file qcryptographichash.cpp.

◆ maxHashBlockSize()

int maxHashBlockSize ( )
constexpr

Definition at line 1274 of file qcryptographichash.cpp.

Referenced by xored().

+ Here is the caller graph for this function:

◆ maxHashLength()

static constexpr int maxHashLength ( )
staticconstexpr

Definition at line 173 of file qcryptographichash.cpp.

◆ minHashBlockSize()

int minHashBlockSize ( )
constexpr

Definition at line 1284 of file qcryptographichash.cpp.

Referenced by xored().

+ Here is the caller graph for this function:

◆ qt_hash_block_size()

static constexpr int qt_hash_block_size ( QCryptographicHash::Algorithm method)
staticconstexpr

Definition at line 1223 of file qcryptographichash.cpp.

◆ SHA224_256AddLength()

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

Definition at line 93 of file qcryptographichash.cpp.

◆ SHA384_512AddLength()

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

Definition at line 98 of file qcryptographichash.cpp.

◆ xored()

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

Definition at line 1305 of file qcryptographichash.cpp.

References gcdHashBlockSize(), maxHashBlockSize(), and minHashBlockSize().

+ Here is the call graph for this function:

Variable Documentation

◆ sha3Final

static Q_CONSTINIT SHA3Final *const sha3Final = Final
static

Definition at line 67 of file qcryptographichash.cpp.

◆ sha3Init

static Q_CONSTINIT SHA3Init *const sha3Init = Init
static

Definition at line 65 of file qcryptographichash.cpp.

◆ sha3Update

static Q_CONSTINIT SHA3Update *const sha3Update = Update
static

Definition at line 66 of file qcryptographichash.cpp.