Path: blob/linux/scryptjane/scrypt-jane-mix_salsa64.h
1201 views
#if !defined(SCRYPT_CHOOSE_COMPILETIME) || !defined(SCRYPT_SALSA64_INCLUDED)12#undef SCRYPT_MIX3#define SCRYPT_MIX "Salsa64/8 Ref"45#undef SCRYPT_SALSA64_INCLUDED6#define SCRYPT_SALSA64_INCLUDED7#define SCRYPT_SALSA64_BASIC89static void10salsa64_core_basic(uint64_t state[16]) {11const size_t rounds = 8;12uint64_t v[16], t;13size_t i;1415for (i = 0; i < 16; i++) v[i] = state[i];1617#define G(a,b,c,d) \18t = v[a]+v[d]; t = ROTL64(t, 32); v[b] ^= t; \19t = v[b]+v[a]; t = ROTL64(t, 13); v[c] ^= t; \20t = v[c]+v[b]; t = ROTL64(t, 39); v[d] ^= t; \21t = v[d]+v[c]; t = ROTL64(t, 32); v[a] ^= t; \2223for (i = 0; i < rounds; i += 2) {24G( 0, 4, 8,12);25G( 5, 9,13, 1);26G(10,14, 2, 6);27G(15, 3, 7,11);28G( 0, 1, 2, 3);29G( 5, 6, 7, 4);30G(10,11, 8, 9);31G(15,12,13,14);32}3334for (i = 0; i < 16; i++) state[i] += v[i];3536#undef G37}3839#endif40414243