Course / 04 Code / Lesson 04 of 11

How to recognize an encoding

Estimated time: 15 min reading · 15 min activity

A string may contain only hex digits and still be an ordinary label. Another may end in = and suggest Base64. These visible features are clues, not proof of how the string was produced. This lesson adds a source note to your decoding method.

A hypothesis is a possible explanation that still needs support. Provenance means information about where evidence came from and how it was produced. A note saying “Base64 of a label” supplies a reason to try that operation. A successful decode can then be compared with that note.

A hash is a value calculated from input by a named hash algorithm, a defined procedure introduced later in the course. Hash values are often written in hex, but hex is also used for many other bytes. The alphabet alone cannot tell you that a hash was calculated.

Before you begin

Estimated time
15 min reading, 15 min activity. Setup and optional practice may take longer.
Where you work
Use the printed text and byte tables in this lesson, with paper or a text editor for notes. No account, installation, or terminal is needed. Each table supplies the complete evidence for its activity.
Without a lab
Work from the complete pair lists and source notes, make your prediction in notes, and compare with the activity’s stated result. The tables are authored models. Reading works without JavaScript. Answer checking needs JavaScript and a secure context, normally HTTPS or a local preview; saving additionally needs usable browser storage.

After this lesson you can:

  • Separate a format hypothesis from a proved decode.
  • Use a provenance note to choose one operation.
  • Reject a hash conclusion that rests only on hex digits.

01Example

The worked string deadbeef contains only hex digits. You can group it as de ad be ef, but you can also read it as eight letters. No source note chooses between those readings. The correct result of this comparison is to keep the interpretation unresolved.

String: deadbeef
Hypothesis: four hex bytes, de ad be ef
Hypothesis: eight letters
Missing: a declared encoding or an algorithm name
Conclusion: undecided. Hex shape is not a hash finding.

02Check the note, then the decode

An alphabet check asks whether the symbols fit a proposed format. Hex permits 0–9 and a–f. Standard Base64 permits letters, digits, +, /, and its padding convention. The alphabets overlap: cafe can pass a hex-symbol check while also being a word.

Next, read the provenance. If the source declares Base64 of text, apply that decode and check that the bytes fit the promised kind of text. A valid decode supports that declared interpretation. It does not prove an unknown author was truthful, nor does it establish the origin of an undeclared string.

If the note is missing, state the plausible readings and the evidence you need. Do not add layers of decoding just because a tool accepts the input. A meaningful-looking result can be accidental.

deadbeef permits more than one interpretation; its shape alone identifies neither an encoding nor a hash algorithm.Model. A teaching model drawn by hand. It shows the idea, not real tool output.

Read the full explanation below.

Possibly four hex bytes de ad be efPossibly eight lettersThis is an identified hash

Supplied string

deadbeef
Selected evidence · Worked undecided string

Missing provenance

No declared encoding or algorithm name supplied.
Source evidence · Worked undecided string
uncertain

Possibly four hex bytes de ad be ef

All pairs fit hex notation, but the method is not declared.

Possible grouping is not a proven interpretation.

Worked undecided string

de ad be ef is a possible four-byte grouping, not an established decoding.

Follow the explanation

  1. de ad be ef is a possible four-byte grouping, not an established decoding.
  2. Eight letters is also a possible interpretation.
  3. The missing method note prevents a hash identification from shape alone.
Read every state and value

1. de ad be ef is a possible four-byte grouping, not an established decoding.

Evidence selected
Supplied string
Current claim
hex
Source origins
Worked undecided string

2. Eight letters is also a possible interpretation.

Evidence selected
Supplied string
Current claim
letters
Source origins
Worked undecided string

3. The missing method note prevents a hash identification from shape alone.

Evidence selected
Supplied string · Missing provenance
Current claim
This is an identified hash
Source origins
Worked undecided string
deadbeef permits more than one interpretation; its shape alone identifies neither an encoding nor a hash algorithm.

03Decide three blobs from their notes

The three fictional blobs have different source notes. Use the notes to decide what to do before consulting the hand results on the cards. These records describe authored examples, not values collected from a real system.

YanoSec / Code
Three authored blobs. Shape is a hypothesis until the provenance card agrees.

Blob A: bGFi
Alphabet fits standard Base64. No padding is required because the source length is a multiple of three bytes.
Declared job: Base64 of a desk label.
Hand decode: 6c 61 62, UTF-8 letters lab.
Supported conclusion: the declared Base64 decode succeeds. Shape alone did not prove it.

Blob B: 6c6162
Alphabet fits hexadecimal. Two digits per byte gives three bytes.
Declared job: hex of the same desk label.
Hand decode: 6c 61 62, the same bytes as blob A.
Supported conclusion: the declared hex decode succeeds.

Blob C: cafe
Alphabet fits hexadecimal, and it is also four ordinary letters.
No declared encoding and no algorithm name.
Two hypotheses: the letters c a f e, or the two bytes ca fe.
Neither hypothesis is proved. A hex-looking string is not a hash by shape.

Download the three blobs and the hand decodes

YanoSec / Code
Original fictional provenance: notes about where the strings came from.
These notes did not come from a real system.

Blob A: stored by the desk as Base64 of a label.
Blob B: stored by the desk as hex of that same label.
Blob C: copied from a slide title. Origin of the characters is unknown.
No item names a hash algorithm, a key, or a signature.
Decode only the item whose note names an operation. Leave blob C as ambiguous.

Download the fictional provenance notes

  1. Read provenance.txt. Record that A declares Base64 of a label, B declares hex of the same label, and C has no declared representation.
  2. For A, match bGFi to the hand grouping 6c 61 62, the ASCII letters lab. Record that the declared operation and the expected kind of result agree.
  3. For B, group 6c6162 into three pairs. Compare them with A: the bytes match despite a different representation.
  4. For C, write both four ordinary letters and two hex bytes as possible readings of cafe. State the missing source declaration, then stop without assigning a hash algorithm.

04Representation module case

Use the separate representation case to combine byte counting, Unicode, and a declared decode. It is a self-review activity: explain each result using the rubric on the card. No program or external puzzle is needed.

YanoSec / Code
Representation module self-review case.
All transforms below are hand groupings, not observed tool output.

Item 1. Hex display: 52 55 4e
Bytes: 3
If those bytes are UTF-8/ASCII letters: R U N

Item 2. Declared code point U+00A9 COPYRIGHT SIGN, UTF-8 bytes c2 a9
Code points: 1
Bytes: 2
A successful decode recovers the declared character. It does not add a second meaning.

Item 3. Base64 UmVk, provenance says Base64 of a color name.
Operation: standard Base64 decode
Hand result: 52 65 64, UTF-8 letters Red
Record the operation. Do not call the step decryption.

Item 4. String 00ff, no provenance.
Hypothesis one: two hex bytes, 00 and ff.
Hypothesis two: four characters, 0 0 f f.
Missing evidence: a declared encoding or an algorithm name.
Hex digits do not prove a hash and do not prove a format.

Rubric: state the byte count, the operation you used, and the fact you still lack for item 4.

Download the representation case

  1. Count the pairs in 52 55 4e. Check: three bytes. Under the stated ASCII reading, they spell RUN.
  2. Compare U+00A9 with its supplied UTF-8 bytes c2 a9. Check: one code point, two bytes.
  3. Follow the declared Base64 operation for UmVk. Compare with the hand result Red, bytes 52 65 64. State the operation alongside the result.
  4. For 00ff, record two bytes or four written characters as competing readings. Explain which source fact is missing. Stop when every conclusion has a reason and a limit.

05Optional challenge

Spend about ten extra minutes adding a third possibility for C: perhaps the characters were copied from the beginning of a longer value. Your self-review question is which extra source fact would distinguish a complete label from a partial copy. The card supplies no hidden fact that resolves it.

06Fresh cases for the checks

Use these fictional cases for the checks below. They have different inputs from the worked examples. Read them here or make notes; no installation or external service is needed.

Recognition case AOwned fixture. An original file made for this course. Follow the activity's instructions in your own lab.

Value P: 72756e. Provenance: exported as hexadecimal bytes of an ASCII label. Byte table: 72=r, 75=u, 6e=n.
Value Q: face. Provenance: unknown copied text. It might mean four letters or the two hex bytes fa ce.
Value R: 32 hex characters copied without any algorithm or generation record.

07Explain your prediction

Optional written self-check: Label interpretations as hypotheses until provenance selects an operation. Record what a successful decode supports and what remains unresolved about source, algorithm and authenticity.

08Common mistakes

If every hex-shaped value becomes a hash, separate the writing system from the operation that produced the value. Ask for the algorithm or a trustworthy source declaration.

If one successful decode leads immediately to more transforms, check whether the note actually declares another layer. Keep unsupported layers as possibilities rather than conclusions.

If both hex and Base64 accept a string, use provenance and the expected data type to guide your interpretation. Decoder acceptance alone cannot choose the source format.

References