void ScryptCore(UInt32 x[32], UInt32 alignedScratch[1024*32+32]) { DECLSPEC_ALIGN(128) UInt32 w[32]; ShuffleForSalsa(w, x); #if UCFG_USE_MASM && !defined(_M_X64) if (s_bHasSse2) ScryptCore_x86x64(w, alignedScratch); else #endif { for (int i=0; i<1024; ++i) { memcpy(alignedScratch+i*32, w, 32*sizeof(UInt32)); Salsa20Core(w, w+16, 8); Salsa20Core(w+16, w, 8); } for (int i=0; i<1024; ++i) { int j = w[16] & 1023; // w[16] is fixed point UInt32 *p = alignedScratch+j*32; for (int k=0; k<32; ++k) w[k] ^= p[k]; Salsa20Core(w, w+16, 8); Salsa20Core(w+16, w, 8); } } UnShuffleForSalsa(x, w); }
void ScryptCore(uint32_t x[32], uint32_t alignedScratch[1024*32+32]) noexcept { #if UCFG_USE_MASM if (s_bHasSse2) { DECLSPEC_ALIGN(128) uint32_t w[32]; ShuffleForSalsa(w, x); ScryptCore_x86x64(w, alignedScratch); UnShuffleForSalsa(x, w); } else #endif { uint32_t tmp[2][16]; NeoScryptCore((SalsaBlockPtr)x, tmp, alignedScratch, 1, 8, 1024, false); /*!!! memcpy(w, x, 32 * sizeof(uint32_t)); for (int i=0; i<1024; ++i) { memcpy(alignedScratch+i*32, w, 32*sizeof(uint32_t)); VectorXor(w, w+16, 16); Salsa20Core(w, 8); VectorXor(w+16, w, 16); Salsa20Core(w+16, 8); } for (int i=0; i<1024; ++i) { int j = w[16] & 1023; // w[16] is fixed point uint32_t *p = alignedScratch+j*32; for (int k=0; k<32; ++k) w[k] ^= p[k]; VectorXor(w, w+16, 16); Salsa20Core(w, 8); VectorXor(w+16, w, 16); Salsa20Core(w+16, 8); } memcpy(x, w, 32 * sizeof(uint32_t)); */ } }