Free tech learning for everyone, from basics to pro

Cyber Security FundamentalsCyber SecurityBeginner

Cryptography basics: encryption, hashing and digital signatures

In short: Cryptography protects data by making it unreadable to outsiders and by proving that it has not been changed and comes from the right sender. Symmetric encryption is fast and uses one shared key; asymmetric encryption uses a public and private key pair; hashing creates a one-way fingerprint; digital signatures prove origin and integrity. HTTPS and VPNs combine them all.

Why cryptography matters

Almost every secure thing you do online relies on cryptography: logging in to your bank, connecting to a VPN, sending a WhatsApp message or updating your phone. It provides three of the most important security goals: confidentiality (only the right people can read data), integrity (data has not been changed) and authenticity (data really comes from who it claims). See the CIA triad.

The building blocks of cryptographySymmetric encryptionone shared keyAsymmetric encryptionpublic + private keyHashingone-way fingerprintDigital signaturesprove who sent itKey exchangeagree a secret safelyCertificatesbind a key to a name
Figure 1. Real protocols such as TLS and VPNs combine all six.

Symmetric encryption

The same key locks and unlocks the data, like a house key. It is very fast, so it is used for bulk data such as files, disks and network traffic. The standard today is AES (Advanced Encryption Standard), usually with 128- or 256-bit keys. The challenge is sharing the key safely: if an attacker gets it, they can read everything.

Asymmetric encryption

Each person has a key pair: a public key that anyone may know and a private key that is kept secret. Data encrypted with the public key can only be decrypted with the private key. It is like a post box: anyone can drop a letter in, only the owner can open it. Common algorithms are RSA and elliptic curve cryptography (ECC). It is slower than symmetric encryption, so it is mainly used to exchange keys and create signatures.

Hashing

A hash function turns any input into a fixed-length fingerprint, such as a SHA-256 value. It is one-way: you cannot get the original back from the hash, and changing one character changes the hash completely. Uses include checking downloaded files and storing passwords. For passwords, systems add a random salt and use slow algorithms designed for passwords (such as bcrypt or Argon2), so stolen hashes are hard to crack. Try our hash generator.

Digital signatures and certificates

To sign data, the sender creates a hash and encrypts it with their private key. Anyone can check it with the sender's public key. If it matches, the data is unchanged and came from the key owner. A certificate is a signed document from a trusted certificate authority saying "this public key belongs to this website or person". See PKI and digital certificates.

How it all comes together in HTTPS

  1. Your browser connects to a website, which sends its certificate.
  2. The browser checks the certificate's signature and that it matches the site name.
  3. Browser and server agree a shared secret using key exchange (elliptic curve Diffie-Hellman).
  4. All further data is encrypted with fast symmetric encryption (usually AES or ChaCha20) using keys from that secret.
  5. Each message also carries integrity protection so changes are detected.

Common mistakes

  • Inventing your own encryption instead of using proven algorithms and libraries.
  • Using outdated algorithms such as DES, RC4, MD5 or SHA-1 for security.
  • Storing encryption keys next to the data they protect.
  • Thinking "encrypted" means "secure" when the key or password is weak.

Looking ahead, quantum computers may one day break RSA and ECC; see post-quantum cryptography.

Practice

What is the main difference between symmetric and asymmetric encryption?
Symmetric uses one shared key; asymmetric uses a public and private key pair.
Why are passwords stored as salted hashes?
So the original password cannot be read back, and the salt makes precomputed cracking much harder.
What does a digital signature prove?
That the data has not been changed and that it was signed by the holder of the private key.

Key takeaways

  • Cryptography provides confidentiality, integrity and authenticity.
  • Symmetric encryption is fast; asymmetric solves key sharing and signatures.
  • Hashes are one-way fingerprints; passwords need salted, slow hashes.
  • HTTPS combines certificates, key exchange and symmetric encryption.
Tracks your learning on this device only. See your progress on the learning paths.
Verified author✓ Valid
Issued to
Mohamed Fayas
Role
Founder of FM TecHub
Credentials
CCNABTEC HND Network EngineeringBEng (Hons) Computer Networking & Cloud Security
Issuer
FM TecHub · fmtechub.com

He writes practical, plain-English guides on networking, security and cloud.

More about the author →

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Email updates: coming soon

New notes, tools and security news from FM TecHub by email, explained simply. Free. We're not collecting email addresses yet; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesopening soon

Meanwhile, stay connected: