private void F(int currentBlock) { // First iteration: // Populate initial salt with the current block index: Buffer.BlockCopy( BlockNumberToBytes(currentBlock), 0, saltAndBlockNumber, salt.Length, 4 ); buffer = prf.Transform(saltAndBlockNumber); // Remaining iterations: byte[] result = buffer; for (long iteration = 2; iteration <= iterationCount; iteration++) { // Note that the PRF transform takes the immediate result of the // last iteration, not the combined result (in buffer): result = prf.Transform(result); for (int byteIndex = 0; byteIndex < buffer.Length; byteIndex++) { buffer[byteIndex] ^= result[byteIndex]; } } }