#include "crypto/equihash.h"
#include "util.h"
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <boost/optional.hpp>
Go to the source code of this file.
|
void | GenerateHash (const eh_HashState &base_state, eh_index g, unsigned char *hash, size_t hLen) |
|
void | ExpandArray (const unsigned char *in, size_t in_len, unsigned char *out, size_t out_len, size_t bit_len, size_t byte_pad) |
|
void | CompressArray (const unsigned char *in, size_t in_len, unsigned char *out, size_t out_len, size_t bit_len, size_t byte_pad) |
|
void | EhIndexToArray (const eh_index i, unsigned char *array) |
|
eh_index | ArrayToEhIndex (const unsigned char *array) |
|
eh_trunc | TruncateIndex (const eh_index i, const unsigned int ilen) |
|
eh_index | UntruncateIndex (const eh_trunc t, const eh_index r, const unsigned int ilen) |
|
std::vector< eh_index > | GetIndicesFromMinimal (std::vector< unsigned char > minimal, size_t cBitLen) |
|
std::vector< unsigned char > | GetMinimalFromIndices (std::vector< eh_index > indices, size_t cBitLen) |
|
| assert (len-trim+(2 *lenIndices)<=WIDTH) |
|
| for (size_t i=trim;i< len;i++) hash[i-trim] = a.hash[i] ^ b.hash[i] |
|
| if (a.IndicesBefore(b, len, lenIndices)) |
|
template<size_t WIDTH> |
bool | HasCollision (StepRow< WIDTH > &a, StepRow< WIDTH > &b, size_t l) |
|
template<size_t WIDTH> |
void | CollideBranches (std::vector< FullStepRow< WIDTH >> &X, const size_t hlen, const size_t lenIndices, const unsigned int clen, const unsigned int ilen, const eh_trunc lt, const eh_trunc rt) |
|
eh_index ArrayToEhIndex |
( |
const unsigned char * |
array | ) |
|
assert |
( |
len-trim+(2 *lenIndices)<= |
WIDTH | ) |
|
Initial value:{
assert(len-trim+(2 *lenIndices)<=WIDTH)
template<size_t WIDTH>
void CollideBranches |
( |
std::vector< FullStepRow< WIDTH >> & |
X, |
|
|
const size_t |
hlen, |
|
|
const size_t |
lenIndices, |
|
|
const unsigned int |
clen, |
|
|
const unsigned int |
ilen, |
|
|
const eh_trunc |
lt, |
|
|
const eh_trunc |
rt |
|
) |
| |
void CompressArray |
( |
const unsigned char * |
in, |
|
|
size_t |
in_len, |
|
|
unsigned char * |
out, |
|
|
size_t |
out_len, |
|
|
size_t |
bit_len, |
|
|
size_t |
byte_pad |
|
) |
| |
void EhIndexToArray |
( |
const eh_index |
i, |
|
|
unsigned char * |
array |
|
) |
| |
void ExpandArray |
( |
const unsigned char * |
in, |
|
|
size_t |
in_len, |
|
|
unsigned char * |
out, |
|
|
size_t |
out_len, |
|
|
size_t |
bit_len, |
|
|
size_t |
byte_pad |
|
) |
| |
for |
( |
| ) |
= a.hash[i] ^ b.hash[i] |
void GenerateHash |
( |
const eh_HashState & |
base_state, |
|
|
eh_index |
g, |
|
|
unsigned char * |
hash, |
|
|
size_t |
hLen |
|
) |
| |
std::vector<eh_index> GetIndicesFromMinimal |
( |
std::vector< unsigned char > |
minimal, |
|
|
size_t |
cBitLen |
|
) |
| |
std::vector<unsigned char> GetMinimalFromIndices |
( |
std::vector< eh_index > |
indices, |
|
|
size_t |
cBitLen |
|
) |
| |
template<size_t WIDTH>
bool HasCollision |
( |
StepRow< WIDTH > & |
a, |
|
|
StepRow< WIDTH > & |
b, |
|
|
size_t |
l |
|
) |
| |
if |
( |
a. |
IndicesBeforeb, len, lenIndices | ) |
|
Initial value:{
std::copy(
b.hash+len,
b.hash+len+lenIndices, hash+len-trim)
Definition at line 246 of file equihash.cpp.