Skip to content
SecureKhan
Go back

Encoding vs Encryption vs Hashing: A Pentester's Guide

Encoding vs Encryption vs Hashing

TL;DR: Encoding transforms data format (reversible, no key). Encryption protects data confidentiality (reversible, requires key). Hashing creates a fingerprint (one-way, no reversal). Developers often confuse these - that’s where vulnerabilities live.


Table of Contents

Open Table of Contents

Quick Reference

At a Glance

PropertyEncodingEncryptionHashing
PurposeData format conversionConfidentialityIntegrity/verification
ReversibleYes (no key needed)Yes (key required)No (one-way)
Key requiredNoYesNo
Output lengthVariableVariable (usually ≥ input)Fixed length
SecurityNoneStrong (if done right)Strong (if done right)
Use caseData transportSecret storagePassword storage

Common Examples

TypeExamples
EncodingBase64, URL encoding, HTML entities, Hex, ASCII
EncryptionAES, RSA, ChaCha20, 3DES
HashingMD5, SHA-1, SHA-256, bcrypt, Argon2

Quick Identification

If you see…It’s probably…
SGVsbG8gV29ybGQ=Base64 encoding
%20%3C%3EURL encoding
<>HTML entity encoding
48656c6c6fHex encoding
U2FsdGVkX1...Encrypted (OpenSSL)
5d41402abc4b2a76b9719d911017c592 (32 chars)MD5 hash
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d (40 chars)SHA-1 hash
$2a$10$...bcrypt hash

Why This Matters for Pentesters

Common Vulnerabilities from Confusion

MistakeVulnerabilityExample
Base64 “encryption”Data exposureAPI tokens in Base64
MD5 for passwordsEasy crackingLegacy password storage
Encryption without authTamperingCBC bit-flipping
Static encryption keysKey exposureHardcoded keys in source
Weak hashingRainbow tablesUnsalted SHA-1 passwords

Real-World Breaches

IncidentIssueImpact
Adobe (2013)3DES ECB + same key153M passwords exposed
LinkedIn (2012)Unsalted SHA-1117M passwords cracked
Ashley Madison (2015)bcrypt (good!) + MD5 tokensTokens cracked
Yahoo (2013)MD5 passwords3B accounts

The Key Differences

Visual Comparison

┌─────────────────────────────────────────────────────────────────────┐
│                           ENCODING                                  │
│                                                                     │
│   "Hello"  ───────►  "SGVsbG8="  ───────►  "Hello"                 │
│              encode               decode                            │
│                                                                     │
│   • Anyone can decode                                               │
│   • No secret/key needed                                            │
│   • NOT for security                                                │
└─────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────┐
│                          ENCRYPTION                                 │
│                                                                     │
│   "Hello"  ──────────►  "x#$%^&"  ──────────►  "Hello"             │
│           encrypt                  decrypt                          │
│           (with key)               (with key)                       │
│                                                                     │
│   • Only key holder can decrypt                                     │
│   • Key must be kept secret                                         │
│   • FOR confidentiality                                             │
└─────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────┐
│                            HASHING                                  │
│                                                                     │
│   "Hello"  ──────────►  "185f8db32271..."                          │
│              hash                                                   │
│                                                                     │
│   "Hello"  ──────────►  "185f8db32271..."  (same input = same hash)│
│                                                                     │
│   • Cannot reverse to get "Hello"                                   │
│   • Same input always gives same output                             │
│   • FOR verification/integrity                                      │
└─────────────────────────────────────────────────────────────────────┘

Decision Tree

Do you need to get the original data back?

├── NO ─────────► Use HASHING
│                 (passwords, integrity checks)

└── YES ──► Does it need to be kept secret?

            ├── NO ─────────► Use ENCODING
            │                 (transport, format conversion)

            └── YES ─────────► Use ENCRYPTION
                              (sensitive data storage/transmission)

Encoding Deep Dive

TL;DR: Encoding converts data to a different format for safe transport. It’s NOT security - anyone can decode it.

Why Encoding Exists

ProblemEncoding Solution
Binary data in text protocolsBase64
Special chars in URLsURL encoding
Special chars in HTMLHTML entities
Human-readable binaryHex, ASCII
Unicode in ASCII systemsUTF-8, UTF-16

Base64 Encoding

Converts binary to text using 64 characters (A-Z, a-z, 0-9, +, /).

Original: Hello World
Binary:   01001000 01100101 01101100 01101100 01101111 ...
Base64:   SGVsbG8gV29ybGQ=

Characteristics:

AttackDetectDefend
Decode “secret” tokensCheck for Base64 patternsNever use Base64 for secrets
Decode API credentialsMonitor for exposed credsUse proper encryption
Bypass filters (XSS)Detect encoding obfuscationDecode before validation
Commands
# Encode to Base64
echo -n "Hello World" | base64
# SGVsbG8gV29ybGQ=

# Decode from Base64
echo "SGVsbG8gV29ybGQ=" | base64 -d
# Hello World

# Python
python3 -c "import base64; print(base64.b64encode(b'Hello').decode())"
python3 -c "import base64; print(base64.b64decode('SGVsbG8=').decode())"

# URL-safe Base64
python3 -c "import base64; print(base64.urlsafe_b64encode(b'Hello').decode())"

# CyberChef (online)
# https://gchq.github.io/CyberChef/

URL Encoding (Percent Encoding)

Encodes special characters for use in URLs.

Original: Hello World!
Encoded:  Hello%20World%21

Common Encodings:

CharacterURL EncodedName
(space)%20 or +Space
<%3CLess than
>%3EGreater than
"%22Quote
'%27Single quote
/%2FSlash
?%3FQuestion mark
&%26Ampersand
=%3DEquals
#%23Hash
\n%0ANewline
\r%0DCarriage return
AttackDetectDefend
Double URL encoding bypassCheck for %25 patternsDecode recursively
Path traversal (%2e%2e%2f)Log decoded pathsNormalize before check
XSS filter bypassDetect encoding variationsDecode before validation
Commands
# URL encode
python3 -c "import urllib.parse; print(urllib.parse.quote('Hello World!'))"
# Hello%20World%21

# URL decode
python3 -c "import urllib.parse; print(urllib.parse.unquote('Hello%20World%21'))"
# Hello World!

# Double encoding
python3 -c "import urllib.parse; print(urllib.parse.quote(urllib.parse.quote('../etc/passwd')))"
# %252e%252e%252fetc%252fpasswd

# Using curl
curl -G --data-urlencode "param=Hello World" "http://example.com"

HTML Entity Encoding

Encodes special characters for safe display in HTML.

Original: <script>alert('XSS')</script>
Encoded:  &lt;script&gt;alert(&#39;XSS&#39;)&lt;/script&gt;

Common Entities:

CharacterNamed EntityNumeric Entity
<&lt;&#60;
>&gt;&#62;
"&quot;&#34;
'&apos;&#39;
&&amp;&#38;
(space)&nbsp;&#160;
AttackDetectDefend
XSS via numeric entitiesCheck for &# patternsProper output encoding
Filter bypass with obscure entitiesDetect unusual entitiesDecode before validation
Mixed encoding attacksLog encoding patternsUse security libraries
Commands
# Python HTML encode
python3 -c "import html; print(html.escape('<script>alert(1)</script>'))"
# &lt;script&gt;alert(1)&lt;/script&gt;

# Python HTML decode
python3 -c "import html; print(html.unescape('&lt;script&gt;'))"
# <script>

# PHP
php -r "echo htmlentities('<script>');"
php -r "echo html_entity_decode('&lt;script&gt;');"

Hex Encoding

Represents bytes as hexadecimal values.

Original: Hello
Hex:      48656c6c6f
AttackDetectDefend
Obfuscate payloadsDetect hex patternsDecode before processing
Bypass WAF rulesMonitor for long hex stringsNormalize input
SQLi via hex stringsLog unusual encodingsInput validation
Commands
# Hex encode
echo -n "Hello" | xxd -p
# 48656c6c6f

# Hex decode
echo "48656c6c6f" | xxd -r -p
# Hello

# Python
python3 -c "print('Hello'.encode().hex())"
python3 -c "print(bytes.fromhex('48656c6c6f').decode())"

# SQL hex encoding (for SQLi)
# SELECT * FROM users WHERE name = 0x61646d696e (admin)

Unicode Encoding

Different representations of Unicode characters.

Character: é
UTF-8:     c3 a9 (2 bytes)
UTF-16:    00e9 (2 bytes)
UTF-32:    000000e9 (4 bytes)
URL:       %C3%A9
HTML:      &#233; or &eacute;
AttackDetectDefend
Homograph attacks (look-alike chars)Check for mixed scriptsNormalize Unicode
Filter bypass via UTF-8 overlongDetect invalid UTF-8Reject invalid encoding
Directory traversal via UnicodeLog unusual pathsUse canonical paths
Commands
# Check encoding
file -bi document.txt

# Convert encodings
iconv -f UTF-8 -t UTF-16 input.txt > output.txt

# Python Unicode
python3 -c "print('\u003cscript\u003e')"
# <script>

# Unicode normalization
python3 -c "import unicodedata; print(unicodedata.normalize('NFC', 'café'))"

Encryption Deep Dive

TL;DR: Encryption makes data unreadable without the key. Symmetric uses one key; asymmetric uses a key pair.

Symmetric vs Asymmetric

┌────────────────────────────────────────────────────────────────┐
│                    SYMMETRIC ENCRYPTION                        │
│                                                                │
│   Same key for encrypt and decrypt                             │
│                                                                │
│   Plaintext ──[Key]──► Ciphertext ──[Key]──► Plaintext        │
│                                                                │
│   Examples: AES, ChaCha20, 3DES                                │
│   Use: Bulk data encryption, disk encryption                   │
│   Speed: Fast                                                  │
│   Challenge: Key distribution                                  │
└────────────────────────────────────────────────────────────────┘

┌────────────────────────────────────────────────────────────────┐
│                   ASYMMETRIC ENCRYPTION                        │
│                                                                │
│   Different keys for encrypt and decrypt                       │
│                                                                │
│   Plaintext ──[Public Key]──► Ciphertext ──[Private Key]──► Plaintext
│                                                                │
│   Examples: RSA, ECC, ElGamal                                  │
│   Use: Key exchange, digital signatures                        │
│   Speed: Slow                                                  │
│   Advantage: No key distribution problem                       │
└────────────────────────────────────────────────────────────────┘

AES (Advanced Encryption Standard)

The gold standard for symmetric encryption.

Parameters:

Modes Comparison:

ModeSecurityUse CaseWeakness
ECBWeakNever usePatterns visible
CBCGoodLegacy systemsIV required, padding attacks
CTRGoodStream-likeNonce reuse catastrophic
GCMBestModern systemsNonce reuse catastrophic

ECB vs CBC (Visual):

ECB Mode (BAD):                    CBC Mode (Good):
┌───────┐  ┌───────┐              ┌───────┐  ┌───────┐
│Block 1│  │Block 1│              │Block 1│  │Block 2│
│ AAAA  │  │ AAAA  │              │ AAAA  │  │ AAAA  │
└───┬───┘  └───┬───┘              └───┬───┘  └───┬───┘
    │          │                      │          │
    ▼          ▼                      ▼          ▼
┌───────┐  ┌───────┐              ┌───────┐  ┌───────┐
│ Same  │  │ Same  │              │ Diff  │  │ Diff  │
│Output!│  │Output!│              │Output │  │Output │
└───────┘  └───────┘              └───────┘  └───────┘

Same input = Same ciphertext      Same input = Different ciphertext
(Information leaked!)             (Pattern hidden)
AttackDetectDefend
ECB pattern analysisCheck for repeated blocksUse GCM mode
CBC padding oracleMonitor decryption errorsUse authenticated encryption
Key extraction from codeCode reviewUse key management service
IV/nonce reuseLog encryption parametersGenerate random IV/nonce
Commands
# === OpenSSL AES Encryption ===

# Encrypt file (AES-256-CBC)
openssl enc -aes-256-cbc -salt -in plaintext.txt -out encrypted.enc -k password

# Decrypt file
openssl enc -aes-256-cbc -d -in encrypted.enc -out decrypted.txt -k password

# AES-256-GCM (recommended)
openssl enc -aes-256-gcm -salt -in plaintext.txt -out encrypted.enc -k password

# === Python AES ===

# pip install pycryptodome
python3 << 'EOF'
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import pad, unpad

key = get_random_bytes(32)  # 256-bit key
cipher = AES.new(key, AES.MODE_GCM)
ciphertext, tag = cipher.encrypt_and_digest(b"Hello World")
print(f"Ciphertext: {ciphertext.hex()}")
print(f"Nonce: {cipher.nonce.hex()}")
print(f"Tag: {tag.hex()}")
EOF

RSA (Rivest-Shamir-Adleman)

Most common asymmetric encryption.

Parameters:

Common Uses:

AttackDetectDefend
Weak key size (<2048)Check certificateUse 2048+ bit keys
Padding oracle (PKCS#1 v1.5)Monitor decryption errorsUse OAEP padding
Timing attacksAnalyze response timesConstant-time operations
Common modulus attackCheck for key reuseUnique keys per system
Commands
# === Generate RSA Key Pair ===

# Generate private key
openssl genrsa -out private.pem 2048

# Extract public key
openssl rsa -in private.pem -pubout -out public.pem

# === Encrypt/Decrypt ===

# Encrypt with public key
openssl rsautl -encrypt -pubin -inkey public.pem -in plaintext.txt -out encrypted.bin

# Decrypt with private key
openssl rsautl -decrypt -inkey private.pem -in encrypted.bin -out decrypted.txt

# === Examine Keys ===

# View private key components
openssl rsa -in private.pem -text -noout

# View public key
openssl rsa -pubin -in public.pem -text -noout

Common Encryption Mistakes

MistakeWhy It’s BadCorrect Approach
ECB modePatterns visibleUse GCM mode
Hardcoded keysKey in source codeUse key management
Same IV/nonceBreaks securityRandom per encryption
No authenticationTampering possibleUse AEAD (AES-GCM)
Home-grown cryptoLikely flawedUse established libraries
MD5/SHA1 for HMACWeak hashUse SHA-256+
Encrypt then MACOrder mattersUse AEAD or MAC-then-Encrypt

Hashing Deep Dive

TL;DR: Hashing creates a fixed-size fingerprint of data. Same input = same hash. Used for passwords, integrity, and deduplication.

Hash Properties

PropertyDescriptionBroken If…
DeterministicSame input = same outputNot applicable
Fixed lengthAny input → fixed outputOutput varies
Pre-image resistantCan’t find input from hashCan reverse hash
Collision resistantCan’t find two inputs with same hashCollisions found
Avalanche effectSmall change = completely different hashSimilar hashes

Hash Comparison

AlgorithmOutput LengthSecuritySpeedUse Case
MD5128 bit (32 hex)BrokenFastChecksums only
SHA-1160 bit (40 hex)WeakFastLegacy, avoid
SHA-256256 bit (64 hex)StrongFastGeneral purpose
SHA-512512 bit (128 hex)StrongFastHigh security
bcrypt184 bitStrongSlowPasswords
Argon2ConfigurableStrongSlowPasswords
scryptConfigurableStrongSlowPasswords

MD5 (Message Digest 5)

Status: Broken - DO NOT use for security

Input:  Hello World
MD5:    b10a8db164e0754105b7a99be72e3fe5

Why It’s Broken:

AttackDetectDefend
Rainbow tablesCheck for MD5 patternsMigrate to bcrypt
Collision attacksMonitor for hash reuseUse SHA-256+
Brute forceLog cracking attemptsAdd salt + iterations
Commands
# Generate MD5
echo -n "Hello World" | md5sum
# b10a8db164e0754105b7a99be72e3fe5

# Python
python3 -c "import hashlib; print(hashlib.md5(b'Hello World').hexdigest())"

# Crack with hashcat
hashcat -m 0 -a 0 hash.txt wordlist.txt

# Crack with john
john --format=raw-md5 --wordlist=wordlist.txt hash.txt

SHA Family

SHA-1: Weak (collision found 2017) SHA-256/512: Currently secure

Input:    Hello World
SHA-1:    0a4d55a8d778e5022fab701977c5d840bbc486d0
SHA-256:  a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e
SHA-512:  2c74fd17edafd80e8447b0d46741ee243b7eb74dd2149a0ab1b9246fb30382f27e853d
          8585719e0e67cbda0daa8f51671064615d645ae27acb15bfb1447f459b
AttackDetectDefend
SHA-1 collisionCheck for SHA-1 usageMigrate to SHA-256
Rainbow tables (unsalted)Monitor for common hashesAlways use salt
Length extensionDetect HMAC bypassUse HMAC, not hash(key+data)
Commands
# SHA-1
echo -n "Hello World" | sha1sum

# SHA-256
echo -n "Hello World" | sha256sum

# SHA-512
echo -n "Hello World" | sha512sum

# Python
python3 -c "import hashlib; print(hashlib.sha256(b'Hello World').hexdigest())"

# Hashcat modes
# SHA-1:   -m 100
# SHA-256: -m 1400
# SHA-512: -m 1700

Password Hashing (bcrypt, Argon2, scrypt)

Why Regular Hashes Are Bad for Passwords:

Password Hashes Are:

bcrypt Hash Format:

$2a$10$N9qo8uLOickgx2ZMRZoMye.IjqQBrkHBSgSst/w/cP/LLyZLxPJhO
│  │  │                      │                                 │
│  │  │                      └── 22 char salt ─────────────────┘
│  │  └── Cost factor (2^10 = 1024 iterations)
│  └── Version (2a, 2b, 2y)
└── Algorithm identifier
AttackDetectDefend
Brute forceMonitor failed loginsUse cost factor 12+
Rainbow tablesN/A (salt prevents)bcrypt includes salt
GPU crackingLog cracking durationUse Argon2id
Commands
# Generate bcrypt hash (Python)
python3 -c "import bcrypt; print(bcrypt.hashpw(b'password', bcrypt.gensalt(rounds=12)))"

# Verify bcrypt
python3 << 'EOF'
import bcrypt
stored = b'$2b$12$...'  # stored hash
if bcrypt.checkpw(b'password', stored):
    print("Match!")
EOF

# Generate Argon2 hash
python3 -c "from argon2 import PasswordHasher; ph = PasswordHasher(); print(ph.hash('password'))"

# Hashcat bcrypt
hashcat -m 3200 -a 0 hash.txt wordlist.txt

# John the Ripper bcrypt
john --format=bcrypt hash.txt

HMAC (Hash-based Message Authentication Code)

Combines hash with secret key for authentication.

HMAC-SHA256(key, message) = hash(key ⊕ opad || hash(key ⊕ ipad || message))

Used For:

AttackDetectDefend
Weak keyCheck key entropyUse 256+ bit keys
Timing attackAnalyze comparison timeConstant-time compare
Key in URLMonitor for key leakageUse headers, not URLs
Commands
# Generate HMAC-SHA256
echo -n "message" | openssl dgst -sha256 -hmac "secret_key"

# Python
python3 -c "import hmac; import hashlib; print(hmac.new(b'key', b'message', hashlib.sha256).hexdigest())"

# Verify HMAC
python3 << 'EOF'
import hmac
import hashlib

def verify_hmac(key, message, signature):
    expected = hmac.new(key, message, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)  # Timing-safe!

print(verify_hmac(b'key', b'message', 'expected_sig'))
EOF

Common Mistakes and Vulnerabilities

Testing Checklist

Vulnerability Matrix

FindingSeverityImpact
Base64 “encryption”HighData exposure
MD5 passwordsHighEasy cracking
SHA1 passwords (unsalted)HighRainbow tables
ECB mode encryptionMediumPattern leakage
Hardcoded keysCriticalFull compromise
Weak bcrypt cost (< 10)MediumFaster cracking
Missing saltHighRainbow tables
Encryption without MACMediumData tampering

Identifying Data Types

By Length

Length (hex chars)Possible Type
32MD5, NTLM
40SHA-1
56SHA-224
64SHA-256, SHA3-256
96SHA-384
128SHA-512, SHA3-512

By Pattern

PatternType
$1$...MD5 crypt
$2a$..., $2b$..., $2y$...bcrypt
$5$...SHA-256 crypt
$6$...SHA-512 crypt
$argon2id$...Argon2
$scrypt$...scrypt
{SHA}...LDAP SHA
{SSHA}...LDAP salted SHA
Ends with = or ==Base64
%XX formatURL encoding

Identification Tools

# hashid
hashid 'b10a8db164e0754105b7a99be72e3fe5'
# [+] MD5

# hash-identifier
hash-identifier
# Enter hash: ...

# hashcat --identify
hashcat --identify hash.txt

# Online: hashes.com/en/tools/hash_identifier

Cracking and Breaking

Hash Cracking Workflow

1. Identify hash type


2. Check online databases
   - crackstation.net
   - hashes.com
   - cmd5.org


3. Try common passwords
   - rockyou.txt
   - common wordlists


4. Rule-based attack
   - hashcat rules
   - john rules


5. Mask attack (patterns)
   - ?d?d?d?d?d?d (6 digits)
   - ?u?l?l?l?l?d?d (Ulllld)


6. Brute force (last resort)

Hashcat Cheat Sheet

Hash TypeModeExample
MD50hashcat -m 0
SHA1100hashcat -m 100
SHA2561400hashcat -m 1400
SHA5121700hashcat -m 1700
bcrypt3200hashcat -m 3200
NTLM1000hashcat -m 1000
MySQL 5300hashcat -m 300
Argon228000hashcat -m 28000
Cracking Commands
# === Hashcat ===

# Dictionary attack
hashcat -m 0 -a 0 hashes.txt rockyou.txt

# With rules
hashcat -m 0 -a 0 hashes.txt rockyou.txt -r rules/best64.rule

# Mask attack (8 char, lowercase + digits)
hashcat -m 0 -a 3 hashes.txt ?l?l?l?l?l?d?d?d

# Combination attack
hashcat -m 0 -a 1 hashes.txt wordlist1.txt wordlist2.txt

# Show cracked
hashcat -m 0 hashes.txt --show

# === John the Ripper ===

# Auto-detect and crack
john hashes.txt

# With wordlist
john --wordlist=rockyou.txt hashes.txt

# With rules
john --wordlist=rockyou.txt --rules hashes.txt

# Show cracked
john --show hashes.txt

# === Online Databases ===

# CrackStation
curl -X POST -d "hash=b10a8db164e0754105b7a99be72e3fe5" https://crackstation.net/

# hashes.com API (requires account)

Tools Reference

Encoding/Decoding

ToolPurposeInstall
base64Base64 encode/decodeBuilt-in
xxdHex encode/decodeapt install xxd
CyberChefAll encodingsgchq.github.io/CyberChef
urlencodeURL encodePython urllib

Encryption

ToolPurposeInstall
opensslAll crypto operationsBuilt-in
gpgPGP encryptionBuilt-in
ageModern encryptionapt install age
ccryptSimple file encryptionapt install ccrypt

Hashing

ToolPurposeInstall
hashcatGPU hash crackingapt install hashcat
johnCPU hash crackingapt install john
hashidHash identificationpip install hashid
hash-identifierHash identificationapt install hash-identifier

Online Resources

ResourceURLUse
CrackStationcrackstation.netHash lookup
hashes.comhashes.comHash lookup
CyberChefgchq.github.io/CyberChefAll encoding
dCodedcode.frMany encodings

Practice Labs

Beginner

ResourceFocusLink
CryptoHackCrypto fundamentalscryptohack.org
TryHackMe - HashingHash basicstryhackme.com
OverTheWire - KryptonClassical cryptooverthewire.org

Intermediate

ResourceFocus
PicoCTFCTF crypto challenges
CryptopalsPractical crypto attacks
Root MeCrypto challenges

Practice Exercises

  1. Identify the encoding:

    • SGVsbG8gV29ybGQ=
    • 48656c6c6f
    • %48%65%6c%6c%6f
  2. Identify the hash:

    • 5d41402abc4b2a76b9719d911017c592
    • $2a$10$N9qo8uLOickgx2ZMRZoMye...
    • 2c74fd17edafd80e8447b0d46741ee24...
  3. Crack these hashes:

    • 5f4dcc3b5aa765d61d8327deb882cf99 (MD5)
    • 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 (SHA1)

Glossary

TermDefinition
AEADAuthenticated Encryption with Associated Data
AESAdvanced Encryption Standard (symmetric)
AsymmetricDifferent keys for encrypt/decrypt
Base64Binary-to-text encoding using 64 characters
bcryptPassword hashing algorithm (slow, salted)
Block cipherEncrypts fixed-size blocks
CBCCipher Block Chaining mode
CollisionTwo inputs producing same hash
ECBElectronic Codebook mode (insecure)
GCMGalois/Counter Mode (AEAD)
HashOne-way function producing fixed-size output
HMACHash-based Message Authentication Code
IVInitialization Vector (for block ciphers)
NonceNumber used once (for stream ciphers)
PaddingAdding bytes to fill block size
Pre-imageFinding input from hash output
Rainbow tablePrecomputed hash-to-password lookup
RSAAsymmetric encryption algorithm
SaltRandom data added before hashing
SHASecure Hash Algorithm family
Stream cipherEncrypts byte-by-byte
SymmetricSame key for encrypt/decrypt

What’s Next?

Now that you understand encoding, encryption, and hashing:

TopicDescriptionLink
TLS/SSL HandshakeHow encryption is negotiatedTLS Deep Dive
PKI & CertificatesHow trust is establishedComing Soon
Authentication FlowsHow auth uses these conceptsAuth Flows Guide
Web App PentestingApply knowledge to web testingWeb App Pentesting Guide

Summary

Understanding encoding, encryption, and hashing is fundamental:

ConceptKey PointPentester Focus
EncodingFormat conversion, not securityDecode “secrets”, bypass filters
EncryptionConfidentiality with keysFind weak ciphers, key exposure
HashingOne-way fingerprintCrack weak hashes, identify algorithms

Remember:


Found this guide helpful? Check out the other posts in the SecureKhan penetration testing series.


Share this post on:

Previous Post
PKI & Certificates for Pentesters: How Digital Trust Works
Next Post
TLS/SSL Handshake Explained: How HTTPS Works and How to Attack It