---
title: "Encoding, encryption, and hashing"
description: "Distinguish three commonly confused transformations by purpose, reversibility, and required secrets."
---

> Documentation Index
> Fetch the complete documentation index at: https://help.serialize.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Encoding, encryption, and hashing

This lesson adapts the learning objective in the [University of Oviedo Cryptography Applications lab](https://ocw.uniovi.es/pluginfile.php/12055/mod_label/intro/Lab%2003.%20Cryptography%20Applications%20%28I%29.pdf): understand what encoding is for and distinguish it from encryption and hashing.

## Learning objectives

By the end, you should be able to:

- Explain why Base64 is not encryption
- Predict whether a transformation is reversible
- Identify when a secret key is required
- Use a hash for comparison without claiming it hides the input
- Save a reproducible Serialize workflow

## Part 1: encoding preserves data

Install [Decode Base64](/recipes/decode-base64/) and run the included sample. Anyone who knows the alphabet can reverse the representation; no secret is involved.

Try the same idea with:

- [Hexadecimal to text](/recipes/encoding/hex-to-text/)
- [Base64url](/recipes/encoding/decode-base64url/)
- [URL parameters](/recipes/encoding/decode-url-parameters/)

**Check yourself:** If two people have the same Base64 text, do they need a shared secret to recover the bytes? Why not?

## Part 2: a classical cipher uses a key

Install [Decode a Vigenère cipher](/recipes/encoding/decode-vigenere/). The operation needs the key `LEMON`; changing that key changes the recovered text.

Vigenère is useful for teaching key-dependent transformation, but it is not suitable for modern confidentiality. A real encryption workflow must also specify mode, nonce or IV handling, authentication, key encoding, and key management.

## Part 3: hashing is one way

Install [Calculate a SHA-256 digest](/recipes/security-analysis/sha256-hash/). Change one character in the input and observe the completely different digest.

Then install [Calculate HMAC-SHA256](/recipes/security-analysis/hmac-sha256/). HMAC adds a secret key so a receiver can authenticate a message. It still does not encrypt the message.

## Comparison

| Property | Encoding | Encryption | Hashing |
| --- | --- | --- | --- |
| Main purpose | Compatibility and representation | Confidentiality | Integrity fingerprint |
| Reversible | Yes | Yes, with the key | No practical inverse |
| Secret required | No | Yes | No for plain hash; yes for HMAC |
| Example | Base64 | AES-GCM | SHA-256 |

## Assignment

Create three tabs with the same input sentence:

1. Encode it as Base64 and decode it again.
2. Calculate its SHA-256 digest.
3. Calculate HMAC-SHA256 with a clearly labeled demonstration key.

Write one sentence explaining what assurance each output does—and does not—provide.

Source: https://help.serialize.dev/courses/encoding-encryption-hashing/index.mdx
