DATSEC1 • CRYPTOGRAPHY
Module 1
Cryptography Foundations�and Practical Tooling
Security goals • plaintext/ciphertext • keys • encoding vs. hashing vs. encryption • classical vs. modern cryptography
CyberChef • OpenSSL • Python
Prof. Justin David Pineda | Assistant Professorial Lecturer
DATSEC1 • CRYPTOGRAPHY
Why Cryptography Matters
02
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Nearly every digital interaction depends on cryptography—even when users never see it.
💬
Messaging
Protects conversations from unauthorized reading and detects tampering.
₱
Online Banking
Secures credentials, transactions, sessions, and server identity.
#
Passwords
Good systems store password verifiers using one-way hashing—not reversible encryption.
✓
Software
Digital signatures help prove software origin and integrity.
Core question for this module:
What problem is a technique solving—and what problem is it NOT solving?
DATSEC1 • CRYPTOGRAPHY
Learning Objectives
03
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
01
Explain the fundamental security goals of cryptography: confidentiality, integrity, authentication, and non-repudiation.
02
Use the terms plaintext, ciphertext, key, algorithm, encryption, and decryption correctly.
03
Differentiate encoding, hashing, and encryption based on purpose, reversibility, and key usage.
04
Compare classical cryptography with modern cryptographic systems at a conceptual level.
05
Use CyberChef, OpenSSL, and Python for simple cryptographic experiments and interpret the results.
DATSEC1 • CRYPTOGRAPHY
The Security Goals of Cryptography
04
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
C
Confidentiality
Keep information secret from unauthorized parties.��Example: encrypted chat.
I
Integrity
Detect whether data was modified after it was created or sent.��Example: file hash.
A
Authentication
Establish that an entity or message is genuinely who/what it claims to be.��Example: certificate.
N
Non-repudiation
Provide strong evidence linking an action/message to its signer.��Example: digital signature.
Cryptography is not “just encryption.” Different mechanisms support different security properties.
A secure design starts by identifying the required security property before selecting the cryptographic mechanism.
DATSEC1 • CRYPTOGRAPHY
Plaintext, Ciphertext, Keys, and Algorithms
05
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
INPUT
PLAINTEXT�Readable/original data
→
ƒ
ENCRYPTION ALGORITHM
Transforms plaintext using a key.
→
CIPHERTEXT�Unreadable-looking output
→
↺
DECRYPT
Recover plaintext with the correct key.
K
Key
Secret or controlled value that determines the transformation. Security should depend on the key—not secrecy of the algorithm.
A
Algorithm
Defined mathematical procedure such as AES. Modern algorithms are usually public and heavily analyzed.
★
Kerckhoffs's Principle
A system should remain secure even if everything except the key is public.
DATSEC1 • CRYPTOGRAPHY
Encoding: Representation, Not Security
06
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Encoding changes how data is represented so systems can store, transmit, or display it reliably.
64
Base64
Text → bytes → printable characters��Example:�Hello → SGVsbG8=��No secret key is required.
0x
Hexadecimal
Bytes represented using 0–9 and A–F.��Example:�A → 41��Common in debugging and crypto output.
%
URL Encoding
Represents reserved URL characters safely.��Example:�space → %20��Designed for transport—not secrecy.
Rule of thumb: if anyone can reverse it without a secret, it is not encryption.
DATSEC1 • CRYPTOGRAPHY
Hashing: A One-Way Fingerprint
07
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
A cryptographic hash function maps data of any size to a fixed-size digest.
#
Key Properties
• Deterministic�• Fixed-size output�• One-way / preimage resistant�• Small input change → very different digest�• Collision resistance
✓
Common Uses
• File integrity checks�• Digital signatures�• Message authentication constructions�• Content identification�• Password verification*
H
Examples
SHA-256 and SHA-3 are modern general-purpose hashes.��MD5 and SHA-1 are considered broken for collision-resistant security uses.
*Passwords require dedicated password-hashing/KDF schemes such as Argon2, scrypt, bcrypt, or PBKDF2—not plain SHA-256.
DATSEC1 • CRYPTOGRAPHY
Encryption: Confidentiality Through a Key
08
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Encryption is a reversible transformation intended to protect confidentiality.
P
1. Plaintext
Original readable data:��“Meet at 10:00”
+
K
2. Key + Algorithm
A cryptographic key controls the transformation.��Example algorithm: AES
→
C
3. Ciphertext
Output should reveal no useful plaintext information without the key.
Encryption protects secrecy; integrity/authentication require the right mode or additional mechanism.
DATSEC1 • CRYPTOGRAPHY
Encoding vs. Hashing vs. Encryption
09
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Technique
Primary Purpose
Reversible?
Secret Key?
Typical Example
Security?
Encoding
Representation / transport
Yes
No
Base64
No
Hashing
Fingerprint / integrity
Designed as no
No
SHA-256
Yes*
Encryption
Confidentiality
Yes, with key
Yes
AES
Yes
*Hashing is a security primitive only when an appropriate cryptographic hash/KDF is used for the intended purpose.
DATSEC1 • CRYPTOGRAPHY
Classical Cryptography: Learning the Core Ideas
10
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Classical ciphers are historically important and useful for understanding substitution, transposition, keys, and cryptanalysis—but they are not secure for modern use.
C
Caesar Cipher
Shift each letter by a fixed amount.��HELLO +3 → KHOOR��Tiny keyspace; easily brute-forced.
S
Substitution Cipher
Replace each plaintext symbol with another symbol.��Larger keyspace, but language frequency leaks patterns.
V
Vigenère Cipher
Uses a repeating keyword to vary shifts.��Stronger than Caesar historically, but still breakable using statistical analysis.
Lesson: “looks scrambled” is not the same as “cryptographically secure.”
DATSEC1 • CRYPTOGRAPHY
Modern Cryptography: Designed for Real Adversaries
11
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
S
Symmetric Cryptography
Same secret key is used for encryption and decryption.��Fast and efficient for bulk data.��Example: AES.
A
Asymmetric Cryptography
Uses a public/private key pair.��Supports key exchange, encryption in some schemes, and signatures.��Examples: RSA, ECC.
H
Hashing & MACs
Hashes provide digests; MACs provide integrity + authentication using a secret key.��Examples: SHA-256, HMAC.
Modern systems combine primitives.
Example: HTTPS uses asymmetric mechanisms to establish trust/key material, symmetric encryption for traffic, and authenticated encryption to protect integrity.
DATSEC1 • CRYPTOGRAPHY
Keys: The Critical Asset
12
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Strong algorithms can still fail when keys are weak, exposed, reused incorrectly, or poorly managed.
1
Generate
Use cryptographically secure randomness.
→
2
Store
Protect keys from unauthorized access; avoid hard-coding secrets.
→
3
Distribute
Deliver keys only to authorized parties through secure mechanisms.
→
4
Rotate
Replace keys based on policy, compromise, or lifecycle requirements.
→
5
Revoke / Destroy
Retire compromised or expired keys so they can no longer be used.
In practice, key management is often harder than choosing the algorithm.
DATSEC1 • CRYPTOGRAPHY
Tool Familiarization: CyberChef
13
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
CyberChef is a browser-based “recipe” environment for transforming and analyzing data. It is excellent for learning because every step is visible.
1
Try Encoding
Input: your name��Operations:�To Base64 → From Base64�To Hex → From Hex��Observe reversibility.
2
Try Classical Ciphers
Use ROT13 or Caesar-style operations.��Change the shift/key and observe patterns.��Ask: how difficult is recovery?
3
Try Hashing
Generate SHA-256 for two nearly identical messages.��Compare the digests.��Observe the avalanche effect.
Do not paste real passwords, confidential data, production keys, or client information into online tools.
DATSEC1 • CRYPTOGRAPHY
Tool Familiarization: OpenSSL
14
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
OpenSSL provides command-line cryptographic utilities. It is useful for hashes, random data, certificates, keys, and encryption experiments.
1
SHA-256 digest
openssl dgst -sha256 sample.txt
2
Random bytes
openssl rand -hex 16
3
Inspect version
openssl version
!
Lab discipline
Use only test data. Record the command, input, output, and what security property the operation demonstrates.
DATSEC1 • CRYPTOGRAPHY
Tool Familiarization: Python
15
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Python helps us inspect bytes, encoding, and hashes programmatically. For production cryptography, use well-maintained cryptographic libraries rather than inventing algorithms.
import base64, hashlib��msg = b"DATSEC1"�print(base64.b64encode(msg).decode())�print(hashlib.sha256(msg).hexdigest())
?
What to Observe
1. Base64 output is reversible.�2. SHA-256 produces a fixed-length digest.�3. Both operate on bytes.�4. Neither example encrypts the message.
Never implement your own “custom encryption” for real systems.
DATSEC1 • CRYPTOGRAPHY
Choosing the Right Technique
16
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Send binary data safely in text
→
ENCODING
Base64
Check whether a download changed
→
HASHING
SHA-256
Keep a file confidential
→
ENCRYPTION
AES-based authenticated encryption
Verify a password without storing it
→
PASSWORD HASHING / KDF
Argon2 / scrypt / bcrypt / PBKDF2
Prove who signed a document
→
DIGITAL SIGNATURE
Public-key signature scheme
Start with the security objective. Then select the primitive and implementation.
DATSEC1 • CRYPTOGRAPHY
Module Summary
17
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
1
Cryptography supports multiple goals
Confidentiality, integrity, authentication, and non-repudiation are distinct requirements.
2
Encoding ≠ hashing ≠ encryption
They differ in purpose, reversibility, and use of keys.
3
Keys matter
Modern cryptography assumes algorithms can be public; key protection is critical.
4
Classical ciphers teach concepts
They are useful for learning but not appropriate for modern security.
5
Tools make concepts observable
CyberChef, OpenSSL, and Python let us experiment with transformations and verify what each technique actually does.
DATSEC1 • CRYPTOGRAPHY
Knowledge Check — Class Participation
18
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Choose ONE question to answer. Explain in your own words and use a practical example when possible.
1
Why is Base64 not a form of encryption?
2
What is the difference between plaintext and ciphertext?
3
What role does a cryptographic key play in encryption?
4
How is hashing different from encryption?
5
Which cryptographic security goal protects data from unauthorized reading?
6
How can hashing help detect whether a file was modified?
7
Why are classical ciphers such as Caesar cipher unsuitable for protecting modern data?
8
What is one practical difference between symmetric and asymmetric cryptography?
9
Why is key management important even when a strong algorithm such as AES is used?
10
Give one real-world scenario and identify whether you would use encoding, hashing, encryption, or a digital signature—and explain why.
DATSEC1 • CRYPTOGRAPHY
Exercise for Next Meeting — Crypto Tool Familiarization
19
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
Group Exercise: “What Does This Technique Actually Do?”
A
Part A — CyberChef
Perform and reverse:�• Base64 encoding�• Hex encoding�• ROT13 / Caesar cipher��Then generate SHA-256 for two similar messages.
B
Part B — OpenSSL / Python
Generate at least:�• One SHA-256 digest�• One random value�• One Base64 output in Python��Record commands/code and outputs.
C
Part C — Analysis
For each operation identify:�• Purpose�• Reversible or not?�• Key required?�• Security property�• Appropriate real-world use
Submission / presentation: 5–7 slides per group with screenshots, observations, and a short conclusion. Use only test/sample data.
DATSEC1 • CRYPTOGRAPHY
References
20
Module 1 — Cryptography Foundations and Practical Tooling
Prof. Justin David Pineda | Assistant Professorial Lecturer
1
NIST. (2020). Recommendation for Key Management: Part 1 — General (SP 800-57 Part 1 Rev. 5).
2
NIST. (2015). Secure Hash Standard (SHS) (FIPS PUB 180-4).
3
NIST. (2001; updated). Advanced Encryption Standard (AES) (FIPS PUB 197).
4
Paar, C., & Pelzl, J. (2010). Understanding Cryptography: A Textbook for Students and Practitioners. Springer.
5
Ferguson, N., Schneier, B., & Kohno, T. (2010). Cryptography Engineering. Wiley.
6
Menezes, A. J., van Oorschot, P. C., & Vanstone, S. A. (1996). Handbook of Applied Cryptography. CRC Press.
7
OpenSSL Project. OpenSSL Documentation — command-line and cryptographic library references.
8
GCHQ. CyberChef — browser-based data transformation and analysis tool.
9
Python Software Foundation. Python Standard Library: hashlib and base64 modules.
Note: Tool demonstrations are for controlled educational use. Do not process confidential, client, or production secrets in public/online tools.