user42272: I'm playing with Over The Air (OTA) updates in my LoLin. I can make connections to my router and OTA updates seem to work well.
I'm uncomfortable storing my WiFi router SSID and password unencrypted in every sketch. Can I store an encrypted password instead for use in WiFi.begin()?
For example, Linux has wpa_pasphrase, which generates a 32-byte number which is an encrypted version of the password which can safely be stored in plaintext configuration files.

user46852: I laud your intention and wish there were a good solution on the ESP8266 for what you're trying to do.
MD5 is a one-way hash function, so you won't be able to simply recover the original string to use in WiFi.begin().
MD5 is also considered to be "cryptographically broken and unsuitable for further use" as of 2008. So if you're concerned about more than just a casual eavesdropping attack sniffing out your password, MD5 isn't considered good for any kind of security application these days.
You'd need to use some form of reversible encryption, but you'd still need to store the key somewhere. If you were using an ESP32, it has the capability of encrypting its flash storage, but the ESP8266 can't do that, so you'll always be vulnerable to someone recovering keys or passwords if they get sufficient access to the CPU.

user4143: 
Can I store an MD5 password hash instead

No. MD5 is a "trapdoor" algorithm. It's one-way. You can make a hash from a password but you cannot make a password from a hash.
You could AES encrypt it, but you would need to have the AES key in your sketch to decrypt the password, which just moves the problem elsewhere.
Typically in a real-world situation you wouldn't have either the SSID or the password in the sketch. Instead you'd create a configuration system which would allow you to set (and of course change) both the SSID and password at runtime, and have the data stored somewhere (either EEPROM or in a file in SPIFFS, for example).
You might want to take a look at WiFiManager which automates that process for you.

user59562: I use Tzapu's WiFiManager https://github.com/tzapu/WiFiManager.
That starts your ESP as a WiFi access point (AP mode) which presents a web page at http://192.168.4.1 where you enter your WiFi SSID and password. It then stores the password and restarts WiFi as a station (STA mode).
On restart if the password is already stored then it just connects as a station. 
If the SSID can't be found it runs the access point again.

42272: <p>I'm playing with Over The Air (OTA) updates in my LoLin. I can make connections to my router and OTA updates seem to work well.</p>

<p>I'm uncomfortable storing my WiFi router SSID and password unencrypted in every sketch. Can I store an encrypted password instead for use in <code>WiFi.begin()</code>?</p>

<p>For example, Linux has wpa_pasphrase, which generates a 32-byte number which is an encrypted version of the password which can safely be stored in plaintext configuration files.</p>
 46852: <p>I laud your intention and wish there were a good solution on the ESP8266 for what you're trying to do.</p>

<p>MD5 is a one-way hash function, so you won't be able to simply recover the original string to use in <code>WiFi.begin()</code>.</p>

<p>MD5 is also considered to be <a href="https://www.kb.cert.org/vuls/id/836068" rel="nofollow noreferrer">"cryptographically broken and unsuitable for further use"</a> as of 2008. So if you're concerned about more than just a casual eavesdropping attack sniffing out your password, MD5 isn't considered good for any kind of security application these days.</p>

<p>You'd need to use some form of reversible encryption, but you'd still need to store the key somewhere. If you were using an ESP32, it has the capability of encrypting its flash storage, but the ESP8266 can't do that, so you'll always be vulnerable to someone recovering keys or passwords if they get sufficient access to the CPU.</p>
 4143: <blockquote>
  <p>Can I store an MD5 password hash instead</p>
</blockquote>

<p>No. MD5 is a "trapdoor" algorithm. It's one-way. You can make a hash from a password but you <em>cannot</em> make a password from a hash.</p>

<p>You could AES encrypt it, but you would need to have the AES key in your sketch to decrypt the password, which just moves the problem elsewhere.</p>

<p>Typically in a real-world situation you wouldn't have either the SSID or the password in the sketch. Instead you'd create a configuration system which would allow you to set (and of course change) both the SSID and password at runtime, and have the data stored somewhere (either EEPROM or in a file in SPIFFS, for example).</p>

<p>You might want to take a look at <a href="https://github.com/tzapu/WiFiManager" rel="nofollow noreferrer">WiFiManager</a> which automates that process for you.</p>
 59562: <p>I use Tzapu's WiFiManager <a href="https://github.com/tzapu/WiFiManager" rel="nofollow noreferrer">https://github.com/tzapu/WiFiManager</a>.</p>

<p>That starts your ESP as a WiFi access point (AP mode) which presents a web page at <a href="http://192.168.4.1" rel="nofollow noreferrer">http://192.168.4.1</a> where you enter your WiFi SSID and password. It then stores the password and restarts WiFi as a station (STA mode).</p>

<p>On restart if the password is already stored then it just connects as a station. </p>

<p>If the SSID can't be found it runs the access point again.</p>
