Bitzu

CPSA ยท Web application assessment: injection, sessions and code

Recognising encoded and hashed values

Spotting Base64, hex, URL encoding and MD5/SHA hashes and what can be done with each.

Key points

  • Encodings are reversible by anyone and give no secrecy.
  • Base64: A-Z, a-z, 0-9, + and /, often = padding, length divisible by 4.
  • Hex: 0-9 and a-f, two characters per byte. URL encoding: %XX such as %20.
  • Hashes: one-way, fixed length; in hex MD5 is 32 characters, SHA-1 40, SHA-256 64.
  • A hash cannot be decoded, only tested against guesses, feasible for weak or unsalted inputs.
  • Decode encoded values; if editable, test tampering.

Source: https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html

Practice questions

Single choice

Which encoding uses the characters A-Z, a-z, 0-9, + and /, and is often padded with = at the end?

  1. Hexadecimal
  2. URL encoding
  3. Base64
  4. ROT13
Show answer

Answer: C. Base64

That is the Base64 alphabet with its padding character. Hex has only 0-9 and a-f, URL encoding is built from %XX sequences, and ROT13 only shifts letters.

Select all that apply

Which of these representations can be reversed by anyone, without a key or guessing?

  1. Base64 text
  2. Hex-encoded bytes
  3. URL-encoded string
  4. SHA-256 digest
  5. AES-encrypted blob
Show answer

Answer: A. Base64 text, B. Hex-encoded bytes, C. URL-encoded string

Base64, hex and URL encoding are public, keyless transformations. A SHA-256 digest is one-way and AES ciphertext needs the key.

True or false

True or false: a value that looks like random letters and digits, such as a Base64 string, is protected because attackers cannot read it.

Show answer

Answer: False

False. Base64 is only an encoding; anyone can decode it in seconds. Looking unreadable is not the same as being protected.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More CPSA topics in this module