Go to the source code of this file.
|
| #define | _(S) |
| |
| #define | decsha3(bits) int sha3_##bits(uint8_t*, size_t, const uint8_t*, size_t); |
| |
| #define | decshake(bits) int shake##bits(uint8_t*, size_t, const uint8_t*, size_t); |
| | libkeccak-tiny
|
| |
| #define | defsha3(bits) |
| |
| #define | defshake(bits) |
| |
| #define | foldP(I, L, F) |
| |
| #define | FOR(i, ST, L, S) _(for (size_t i = 0; i < L; i += ST) { S; }) |
| |
| #define | FOR5(v, s, e) |
| |
| #define | mkapply_ds(NAME, S) |
| |
| #define | mkapply_sd(NAME, S) |
| |
| #define | P keccakf |
| |
| #define | Plen 200 |
| |
| #define | REPEAT24(e) REPEAT6(e e e e) |
| |
| #define | REPEAT5(e) e e e e e |
| |
| #define | REPEAT6(e) e e e e e e |
| |
| #define | rol(x, s) (((x) << s) | ((x) >> (64 - s))) |
| |
|
| h256 | dev::EmptySHA3 = sha3(bytesConstRef()) |
| |
| static const uint8_t | dev::keccak::pi [24] = {10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1} |
| |
| static const uint64_t | dev::keccak::RC [24] |
| |
- Author
- Gav Wood i@gav.nosp@m.wood.nosp@m..com
- Date
- 2014
Definition in file SHA3.cpp.
◆ decsha3
| #define decsha3 |
( |
|
bits | ) |
int sha3_##bits(uint8_t*, size_t, const uint8_t*, size_t); |
◆ decshake
| #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 45 of file SHA3.cpp.
◆ defsha3
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); \
}
◆ defshake
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); \
}
◆ foldP
| #define foldP |
( |
|
I, |
|
|
|
L, |
|
|
|
F |
|
) |
| |
Value: while (L >= rate) { \
F(a, I, rate); \
P(a); \
I += rate; \
L -= rate; \
}
◆ FOR
| #define FOR |
( |
|
i, |
|
|
|
ST, |
|
|
|
L, |
|
|
|
S |
|
) |
| _(for (size_t i = 0; i < L; i += ST) { S; }) |
◆ FOR5
Value: v = 0; \
REPEAT5(e; v += s;)
Definition at line 87 of file SHA3.cpp.
◆ mkapply_ds
| #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); \
}
Definition at line 124 of file SHA3.cpp.
◆ mkapply_sd
| #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); \
}
Definition at line 129 of file SHA3.cpp.
◆ Plen
◆ REPEAT24
| #define REPEAT24 |
( |
|
e | ) |
REPEAT6(e e e e) |
◆ REPEAT5
| #define REPEAT5 |
( |
|
e | ) |
e e e e e |
◆ REPEAT6
| #define REPEAT6 |
( |
|
e | ) |
e e e e e e |
◆ rol
| #define rol |
( |
|
x, |
|
|
|
s |
|
) |
| (((x) << s) | ((x) >> (64 - s))) |