Fabcoin Core  0.16.2
P2P Digital Currency
Namespaces | Macros | Functions | Variables
SHA3.cpp File Reference
#include "SHA3.h"
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "RLP.h"
#include "picosha2.h"
Include dependency graph for SHA3.cpp:

Go to the source code of this file.

Namespaces

 dev
 Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Originally by RenĂ© Nyffenegger.
 
 dev::keccak
 

Macros

#define decshake(bits)   int shake##bits(uint8_t*, size_t, const uint8_t*, size_t);
 libkeccak-tiny More...
 
#define decsha3(bits)   int sha3_##bits(uint8_t*, size_t, const uint8_t*, size_t);
 
#define rol(x, s)   (((x) << s) | ((x) >> (64 - s)))
 
#define REPEAT6(e)   e e e e e e
 
#define REPEAT24(e)   REPEAT6(e e e e)
 
#define REPEAT5(e)   e e e e e
 
#define FOR5(v, s, e)
 
#define _(S)   do { S } while (0)
 
#define FOR(i, ST, L, S)   _(for (size_t i = 0; i < L; i += ST) { S; })
 
#define mkapply_ds(NAME, S)
 
#define mkapply_sd(NAME, S)
 
#define P   keccakf
 
#define Plen   200
 
#define foldP(I, L, F)
 
#define defshake(bits)
 
#define defsha3(bits)
 

Functions

 dev::keccak::decshake (128) decshake(256) decsha3(224) decsha3(256) decsha3(384) decsha3(512) static const uint8_t rho[24]
 
 dev::keccak::mkapply_ds (xorin, dst[i]^=src[i]) mkapply_sd(setout
 
bool dev::sha3 (bytesConstRef _input, bytesRef o_output)
 Calculate SHA3-256 hash of the given input and load it into the given output. More...
 

Variables

h256 dev::EmptySHA3 = sha3(bytesConstRef())
 
h256 dev::EmptyListSHA3 = sha3(rlpList())
 

Detailed Description

Author
Gav Wood i@gav.nosp@m.wood.nosp@m..com
Date
2014

Definition in file SHA3.cpp.

Macro Definition Documentation

#define _ (   S)    do { S } while (0)

Definition at line 132 of file SHA3.cpp.

#define decsha3 (   bits)    int sha3_##bits(uint8_t*, size_t, const uint8_t*, size_t);

Definition at line 53 of file SHA3.cpp.

#define decshake (   bits)    int shake##bits(uint8_t*, size_t, const uint8_t*, size_t);

libkeccak-tiny

A single-file implementation of SHA-3 and SHAKE.

Implementor: David Leon Gil License: CC0, attribution kindly requested. Blame taken too, but not liability.

Definition at line 50 of file SHA3.cpp.

#define defsha3 (   bits)
Value:
int sha3_##bits(uint8_t* out, size_t outlen, \
const uint8_t* in, size_t inlen) { \
if (outlen > (bits/8)) { \
return -1; \
} \
return hash(out, outlen, in, inlen, 200 - (bits / 4), 0x01); \
}
if(a.IndicesBefore(b, len, lenIndices))
Definition: equihash.cpp:243
#define defshake (   bits)
Value:
int shake##bits(uint8_t* out, size_t outlen, \
const uint8_t* in, size_t inlen) { \
return hash(out, outlen, in, inlen, 200 - (bits / 4), 0x1f); \
}
#define foldP (   I,
  L,
  F 
)
Value:
while (L >= rate) { \
F(a, I, rate); \
P(a); \
I += rate; \
L -= rate; \
}
#define a(i)
#define F(x, y, z)
Definition: Hash.cpp:79
#define I(x, y, z)
Definition: Hash.cpp:82
#define P
#define FOR (   i,
  ST,
  L,
  S 
)    _(for (size_t i = 0; i < L; i += ST) { S; })

Definition at line 133 of file SHA3.cpp.

#define FOR5 (   v,
  s,
  e 
)
Value:
v = 0; \
REPEAT5(e; v += s;)
#define REPEAT5(e)
Definition: SHA3.cpp:88
#define e(i)
Definition: sha.cpp:733

Definition at line 89 of file SHA3.cpp.

#define mkapply_ds (   NAME,
  S 
)
Value:
static inline void NAME(uint8_t* dst, \
const uint8_t* src, \
size_t len) { \
FOR(i, 1, len, S); \
}
#define FOR(i, ST, L, S)
Definition: SHA3.cpp:133
#define S(a)
Definition: mars.cpp:50

Definition at line 135 of file SHA3.cpp.

#define mkapply_sd (   NAME,
  S 
)
Value:
static inline void NAME(const uint8_t* src, \
uint8_t* dst, \
size_t len) { \
FOR(i, 1, len, S); \
}
#define FOR(i, ST, L, S)
Definition: SHA3.cpp:133
#define S(a)
Definition: mars.cpp:50

Definition at line 141 of file SHA3.cpp.

#define P   keccakf
#define Plen   200
#define REPEAT24 (   e)    REPEAT6(e e e e)

Definition at line 87 of file SHA3.cpp.

#define REPEAT5 (   e)    e e e e e

Definition at line 88 of file SHA3.cpp.

#define REPEAT6 (   e)    e e e e e e

Definition at line 86 of file SHA3.cpp.

#define rol (   x,
 
)    (((x) << s) | ((x) >> (64 - s)))

Definition at line 85 of file SHA3.cpp.