SteelReed

Search

Search posts, questions…

SecurityQuestion 2 / 24

Junior

How do encoding, hashing, encryption and signing differ? Is a JWT payload secret?

Short answer

Encoding only changes format, hashing is one-way, encryption needs a key to read (secrecy), signing needs a key to create (tamper-proof, proves origin). A normal JWT is only signed, so anyone can read the payload.

change formatcompare, one-waykeep secrettamper-proof, originWhat do you need?Encoding: Base64Hashing: SHA-256Encryption: AES-GCMSigning: HMAC, ECDSA

3 points to say:

  1. Encoding decodes for anyone and protects nothing; a plain hash has no key, so it proves no origin (modify, then recompute the hash).
  2. Encryption protects secrecy (AEAD adds integrity); signing (HMAC, RSA/ECDSA) protects integrity + origin.
  3. A JWT (JWS) is only signed + Base64URL: never put sensitive data in the payload.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.