DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
HMACSHA256.cpp File Reference
#include "pch.h"
#include "System/Security/Cryptography/HMACSHA256.h"
#include "System/ArgumentNullException.h"
#include <cstring>

Go to the source code of this file.

Namespaces

namespace  DotNetDupe
namespace  DotNetDupe::System
namespace  DotNetDupe::System::Security
namespace  DotNetDupe::System::Security::Cryptography

Macros

#define SHA256_F1(x)
#define SHA256_F2(x)
#define SHA256_F3(x)
#define SHA256_F4(x)
#define SHA2_CH(x, y, z)
#define SHA2_MAJ(x, y, z)
#define SHA2_PACK32(str, x)
#define SHA2_ROTR(x, n)
#define SHA2_SHFR(x, n)
#define SHA2_UNPACK32(x, str)

Functions

static void DotNetDupe::System::Security::Cryptography::ComputeHmacDigests (const unsigned char *k_ipad, const unsigned char *k_opad, const Array< char > &buffer, unsigned char *outer_digest)
static void DotNetDupe::System::Security::Cryptography::PrepareHmacPads (const Array< char > &key, unsigned char *k_ipad, unsigned char *k_opad)

Variables

static const unsigned int DotNetDupe::System::Security::Cryptography::sha256_k [64]

Macro Definition Documentation

◆ SHA256_F1

#define SHA256_F1 ( x)
Value:
(SHA2_ROTR(x, 2) ^ SHA2_ROTR(x, 13) ^ SHA2_ROTR(x, 22))
#define SHA2_ROTR(x, n)

Definition at line 16 of file HMACSHA256.cpp.

◆ SHA256_F2

#define SHA256_F2 ( x)
Value:
(SHA2_ROTR(x, 6) ^ SHA2_ROTR(x, 11) ^ SHA2_ROTR(x, 25))

Definition at line 17 of file HMACSHA256.cpp.

◆ SHA256_F3

#define SHA256_F3 ( x)
Value:
(SHA2_ROTR(x, 7) ^ SHA2_ROTR(x, 18) ^ SHA2_SHFR(x, 3))
#define SHA2_SHFR(x, n)

Definition at line 18 of file HMACSHA256.cpp.

◆ SHA256_F4

#define SHA256_F4 ( x)
Value:
(SHA2_ROTR(x, 17) ^ SHA2_ROTR(x, 19) ^ SHA2_SHFR(x, 10))

Definition at line 19 of file HMACSHA256.cpp.

◆ SHA2_CH

#define SHA2_CH ( x,
y,
z )
Value:
((x & y) ^ (~x & z))

Definition at line 14 of file HMACSHA256.cpp.

◆ SHA2_MAJ

#define SHA2_MAJ ( x,
y,
z )
Value:
((x & y) ^ (x & z) ^ (y & z))

Definition at line 15 of file HMACSHA256.cpp.

◆ SHA2_PACK32

#define SHA2_PACK32 ( str,
x )
Value:
{ \
*(x) = ((unsigned int) *((str) + 3) ) \
| ((unsigned int) *((str) + 2) << 8) \
| ((unsigned int) *((str) + 1) << 16) \
| ((unsigned int) *((str) + 0) << 24);\
}

Definition at line 29 of file HMACSHA256.cpp.

◆ SHA2_ROTR

#define SHA2_ROTR ( x,
n )
Value:
((x >> n) | (x << ((sizeof(x) << 3) - n)))

Definition at line 13 of file HMACSHA256.cpp.

◆ SHA2_SHFR

#define SHA2_SHFR ( x,
n )
Value:
(x >> n)

Definition at line 12 of file HMACSHA256.cpp.

◆ SHA2_UNPACK32

#define SHA2_UNPACK32 ( x,
str )
Value:
{ \
*((str) + 3) = (unsigned char) ((x) ); \
*((str) + 2) = (unsigned char) ((x) >> 8); \
*((str) + 1) = (unsigned char) ((x) >> 16); \
*((str) + 0) = (unsigned char) ((x) >> 24); \
}

Definition at line 21 of file HMACSHA256.cpp.