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.
3 points to say:
- Encoding decodes for anyone and protects nothing; a plain hash has no key, so it proves no origin (modify, then recompute the hash).
- Encryption protects secrecy (AEAD adds integrity); signing (HMAC, RSA/ECDSA) protects integrity + origin.
- 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.