Encryption turns readable data (plaintext) into scrambled data (ciphertext) with a key, and back again with the right key. The maths is public and well tested; the key is the secret. Never invent your own encryption: use well-known methods from a trusted library.
Symmetric encryption uses the same key to lock and unlock. It's fast, so it's used for the bulk of data; AES is the standard. Its problem is sharing the key safely. Public-key (asymmetric) encryption uses a pair: a public key anyone can have, and a private key only the owner keeps. Data locked with the public key can only be opened with the private key. RSA and elliptic-curve methods are the common ones. In practice they work together: public-key maths agrees a fresh symmetric key, and the symmetric key does the rest. That's what HTTPS (TLS) does every time you load a secure page.
Encrypt data in transit (moving over a network: TLS for websites and email, SSH, VPNs) and at rest (stored: full-disk encryption on laptops and phones, encrypted databases and backups). A stolen laptop with full-disk encryption is a lost laptop, not a data breach.
A hash is a one-way fingerprint. The same input always gives the same hash, a tiny change gives a completely different one, and you can't work back from the hash to the input. SHA-256 is the common one; MD5 and SHA-1 are broken for security use.
Sites shouldn't store your password, only a hash of it, and when you sign in they hash what you typed and compare. Each password gets a salt first, a random value stored beside the hash, so two people with the same password get different hashes and pre-computed tables of common hashes are useless. Password hashing uses deliberately slow methods (Argon2, bcrypt, scrypt or PBKDF2) so guessing is slow too. (b"..." is text as bytes, which hashing needs, and [:16] keeps the first 16 characters to save space.)
A digital signature is the private key used the other way round: the owner signs a hash of a document or program, and anyone with the public key can check it came from them and wasn't changed. Software updates and website certificates are signed this way.
Practice
Which uses one shared key to both lock and unlock?
More info
Quick reference
Symmetric (AES)
One key locks and unlocks; fast.
Public key (RSA, ECC)
Public key locks, private key unlocks.
In transit, at rest
Moving over a network; stored on a disk.
Hash (SHA-256)
One-way fingerprint; tiny change, totally different hash.
Salt
Random value added before hashing a password.
Argon2, bcrypt, scrypt, PBKDF2
Slow hashes made for passwords.
Digital signature
Proves who made something and that it's unchanged.