/* CryptoNight Step 4: Sequentially pass through the mixing buffer * and use 10 rounds of AES encryption to mix the random data back * into the 'text' buffer. */ private static void EncryptScratchpadToText(CNState cnState, ICryptoNight cnParams, byte[] scratchpad) { /* Reinitialize text from state */ byte[] text = cnState.GetText(); /* Expand our initial key into many for each round of pseudo aes */ byte[] expandedKeys = AES.ExpandKey(cnState.GetAESKey2(), true); for (int i = 0; i < cnParams.InitRounds; i++) { AES.AESPseudoRoundXOR( expandedKeys, text, scratchpad, i * Constants.INIT_SIZE_BYTE ); } cnState.SetText(text); }