Using NTC Thermistor with Arduino and esp32
The sketch works for both Arduino and ESP32 by just changing the line:
bool esp32 = true; // change to false when using Arduino
The sketch assumed that NTC Thermistor with 10k resistance at 25 degree Celcius and B parameter of 3950 to be used, if you have an Thermistor with 100k value, you may need to change some of the parameters accordingly.
ESP32 Linearity issue
To address the ESP32 ADC non-linear issue, a lookup table is used to correct the non-linearity. You may need to generate your own lookup table as it varies from device to device due to the variation of ESP32 internal reference voltage. The code for generating the lookup table is written by Helmut Weber and can be found here.
Noise on ESP32
The ESP32 is much noisy compare to Arduino. Add a 0.1uF capacity on Vout would help a little bit in smoothing out the noise or alternative write a filter algorithm to handle it.
For more detail discussion and references, read my blog post on the subject.