Raven Core  3.0.0
P2P Digital Currency
Macros | Functions
sha2.c File Reference
#include "miner.h"
#include "algo-gate-api.h"
#include <string.h>
#include <inttypes.h>
Include dependency graph for sha2.c:

Go to the source code of this file.

Macros

#define Ch(x, y, z)   ((x & (y ^ z)) ^ z)
 
#define Maj(x, y, z)   ((x & (y | z)) | (y & z))
 
#define ROTR(x, n)   ((x >> n) | (x << (32 - n)))
 
#define S0(x)   (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
 
#define S1(x)   (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
 
#define s0(x)   (ROTR(x, 7) ^ ROTR(x, 18) ^ (x >> 3))
 
#define s1(x)   (ROTR(x, 17) ^ ROTR(x, 19) ^ (x >> 10))
 
#define RND(a, b, c, d, e, f, g, h, k)
 
#define RNDr(S, W, i)
 

Functions

void sha256_init (uint32_t *state)
 
void sha256_transform (uint32_t *state, const uint32_t *block, int swap)
 
void sha256d (unsigned char *hash, const unsigned char *data, int len)
 
int scanhash_sha256d (int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done)
 
bool register_sha256d_algo (algo_gate_t *gate)
 

Macro Definition Documentation

◆ Ch

#define Ch (   x,
  y,
 
)    ((x & (y ^ z)) ^ z)

Definition at line 51 of file sha2.c.

◆ Maj

#define Maj (   x,
  y,
 
)    ((x & (y | z)) | (y & z))

Definition at line 52 of file sha2.c.

◆ RND

#define RND (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)
Value:
do { \
t0 = h + S1(e) + Ch(e, f, g) + k; \
t1 = S0(a) + Maj(a, b, c); \
d += t0; \
h = t0 + t1; \
} while (0)
#define Ch(x, y, z)
Definition: sha2.c:51
#define S1(x)
Definition: sha2.c:55
#define S0(x)
Definition: sha2.c:54
#define Maj(x, y, z)
Definition: sha2.c:52

Definition at line 60 of file sha2.c.

◆ RNDr

#define RNDr (   S,
  W,
 
)
Value:
RND(S[(64 - i) % 8], S[(65 - i) % 8], \
S[(66 - i) % 8], S[(67 - i) % 8], \
S[(68 - i) % 8], S[(69 - i) % 8], \
S[(70 - i) % 8], S[(71 - i) % 8], \
W[i] + sha256_k[i])
#define RND(a, b, c, d, e, f, g, h, k)
Definition: sha2.c:60
#define S(x0, x1, x2, x3, cb, r)
Definition: jh.c:494

Definition at line 69 of file sha2.c.

◆ ROTR

#define ROTR (   x,
 
)    ((x >> n) | (x << (32 - n)))

Definition at line 53 of file sha2.c.

◆ S0

#define S0 (   x)    (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))

Definition at line 54 of file sha2.c.

◆ s0

#define s0 (   x)    (ROTR(x, 7) ^ ROTR(x, 18) ^ (x >> 3))

Definition at line 56 of file sha2.c.

◆ S1

#define S1 (   x)    (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))

Definition at line 55 of file sha2.c.

◆ s1

#define s1 (   x)    (ROTR(x, 17) ^ ROTR(x, 19) ^ (x >> 10))

Definition at line 57 of file sha2.c.

Function Documentation

◆ register_sha256d_algo()

bool register_sha256d_algo ( algo_gate_t *  gate)

Definition at line 640 of file sha2.c.

Here is the call graph for this function:

◆ scanhash_sha256d()

int scanhash_sha256d ( int  thr_id,
struct work *  work,
uint32_t  max_nonce,
uint64_t *  hashes_done 
)

Definition at line 590 of file sha2.c.

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

◆ sha256_init()

void sha256_init ( uint32_t *  state)

Definition at line 45 of file sha2.c.

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

◆ sha256_transform()

void sha256_transform ( uint32_t *  state,
const uint32_t *  block,
int  swap 
)

Definition at line 82 of file sha2.c.

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

◆ sha256d()

void sha256d ( unsigned char *  hash,
const unsigned char *  data,
int  len 
)

Definition at line 199 of file sha2.c.

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