Added reference hashes.
This commit is contained in:
parent
8b60585004
commit
79779b51da
4 changed files with 56 additions and 34 deletions
|
@ -35,6 +35,7 @@
|
|||
|
||||
|
||||
#include "crypto/CryptoNight.h"
|
||||
#include "crypto/CryptoNight_monero.h"
|
||||
#include "crypto/soft_aes.h"
|
||||
|
||||
|
||||
|
@ -137,20 +138,6 @@ static inline __m128i sl_xor(__m128i tmp1)
|
|||
}
|
||||
|
||||
|
||||
template<uint8_t rcon>
|
||||
static inline void aes_genkey_sub(__m128i* xout0, __m128i* xout2)
|
||||
{
|
||||
// __m128i xout1 = _mm_aeskeygenassist_si128(*xout2, rcon);
|
||||
// xout1 = _mm_shuffle_epi32(xout1, 0xFF); // see PSHUFD, set all elems to 4th elem
|
||||
// *xout0 = sl_xor(*xout0);
|
||||
// *xout0 = _mm_xor_si128(*xout0, xout1);
|
||||
// xout1 = _mm_aeskeygenassist_si128(*xout0, 0x00);
|
||||
// xout1 = _mm_shuffle_epi32(xout1, 0xAA); // see PSHUFD, set all elems to 3rd elem
|
||||
// *xout2 = sl_xor(*xout2);
|
||||
// *xout2 = _mm_xor_si128(*xout2, xout1);
|
||||
}
|
||||
|
||||
|
||||
template<uint8_t rcon>
|
||||
static inline void soft_aes_genkey_sub(__m128i* xout0, __m128i* xout2)
|
||||
{
|
||||
|
@ -346,11 +333,10 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output)
|
|||
|
||||
|
||||
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES, bool MONERO>
|
||||
inline bool cryptonight_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
inline void cryptonight_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
{
|
||||
keccak(static_cast<const uint8_t*>(input), (int) size, ctx->state0, 200);
|
||||
|
||||
VARIANT1_CHECK();
|
||||
VARIANT1_INIT(0);
|
||||
|
||||
cn_explode_scratchpad<MEM, SOFT_AES>((__m128i*) ctx->state0, (__m128i*) ctx->memory);
|
||||
|
@ -404,17 +390,15 @@ inline bool cryptonight_hash(const void *__restrict__ input, size_t size, void *
|
|||
|
||||
keccakf(h0, 24);
|
||||
extra_hashes[ctx->state0[0] & 3](ctx->state0, 200, static_cast<char*>(output));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES, bool MONERO>
|
||||
inline bool cryptonight_double_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, struct cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
inline void cryptonight_double_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, struct cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
{
|
||||
keccak((const uint8_t *) input, (int) size, ctx->state0, 200);
|
||||
keccak((const uint8_t *) input + size, (int) size, ctx->state1, 200);
|
||||
|
||||
VARIANT1_CHECK();
|
||||
VARIANT1_INIT(0);
|
||||
VARIANT1_INIT(1);
|
||||
|
||||
|
@ -506,7 +490,6 @@ inline bool cryptonight_double_hash(const void *__restrict__ input, size_t size,
|
|||
|
||||
extra_hashes[ctx->state0[0] & 3](ctx->state0, 200, static_cast<char*>(output));
|
||||
extra_hashes[ctx->state1[0] & 3](ctx->state1, 200, static_cast<char*>(output) + 32);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* __CRYPTONIGHT_ARM_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue