The key difference is that something that has been encrypted can be decrypted and the exactly same original message can be restored.
Encryption is used when you want to make something unreadable but also want to be able to restore the data from this unreadable state.
When something is hashed, the created hash is often much smaller and has less information. That means information gets lost and the original message can never be found from the hash.
Hashing is used, when you want to make something unreadable that should not be restored from the hash. (Like a password)
That way a person/server can check if the hash of your password matches, without knowing your actual password.
Encryption is the use of a [cipher](https://en.wikipedia.org/wiki/Cipher
) to render a stream of data unreadable by anyone who doesn't know how to decipher it. Ciphers don't do anything other than scramble the plain text; the result is exactly the same size so the original can be reconstructed.
A hash function is a way to produce a _digest_, or a very short summary of a stream of data.
Reddit's [Auto TL;DR bot](https://www.reddit.com/user/autotldr
) is a good example of something the produces a digest. If you put the same article into it twice, it will produce the same digest. If you put two different articles into it, even if they're about the same topic, it will, at least in theory, produce two different digests, which would tell you that the two articles aren't the same. (You can see this in the bot's posting history from today, where multiple articles about a comment made by President Trump are digested.) The article digest doesn't represent all of the content of what was digested, which means you can't reconstruct the original article from the digest.
Hashes are [cryptographic digests](https://en.wikipedia.org/wiki/Cryptographic_hash_function
) that represent a blob of data as a large number. Like article digests, they're not a full representation of the original content and can't be used to reconstitute it. What makes hashing valuable is the fact that a good algorithm will have a low enough collision rate that it would be exceedingly difficult to come up with content that will produce the same hash value. If I give you a password of "mumble" and use the SHA1 algorithm to hash it, you'll store the value b2e80024f443e922aea693ab4ed0027b2c51a2b6 in your password database. When I go to authenticate myself later, if I give you the same password, it will hash out to the same value. If I give you something different, like "bumble," its hash will be 4d7ee105be643583fc8cd836c7104748780b783d, which is very different and means what I gave you isn't the same. This makes hashes great for storing passwords, because even if they're exposed, it's not very practical to come up with a string that produces the same one.