Skip to content
Home Tutorials Roadmaps Courses Classroom Training Blog
Log in Join free
Computer Science Beginner Free

Security Fundamentals

Lesson 11 of 17 · Cybersecurity Basics 65%
1. Introduction to CS
What is Computer Science?
6. Operating Systems
OS Fundamentals
7. Cybersecurity Basics
Security Fundamentals
8. Software Engineering
Software Development Life Cycle
9. Cloud Computing
Cloud Computing Basics
10. Dynamic Programming
Dynamic Programming Introduction
11. AI & Machine Learning
Introduction to AI & ML
12. Internet of Things
IoT Fundamentals
13. Blockchain Basics
How Blockchain Works

Computer security protects systems and data from unauthorized access, attacks, and damage.

Key Concepts

  • CIA Triad — Confidentiality, Integrity, Availability
  • Authentication — verifying identity
  • Authorization — granting access
  • Encryption — protecting data

Syntax

COMPUTER-SCIENCE
# Hashing (one-way)
import hashlib
hash_obj = hashlib.sha256("password".encode())
print(hash_obj.hexdigest())

# Encryption
from cryptography.fernet import Fernet
key = Fernet.generate_key()
cipher = Fernet(key)
encrypted = cipher.encrypt(b"secret")
Hashing and Encryption
PYTHON
import hashlib

# Password hashing
def hash_password(password):
    return hashlib.sha256(password.encode()).hexdigest()

# Verify password
def verify(password, hashed):
    return hash_password(password) == hashed

password = "mySecret123"
hashed = hash_password(password)
print(f"Password: {password}")
print(f"Hash: {hashed}")
print(f"Verify correct: {verify(password, hashed)}")
print(f"Verify wrong: {verify('wrong', hashed)}")

Practice

1
Exercise

What is the CIA Triad?

Answer
Confidentiality (secrecy), Integrity (accuracy), Availability (access).

Quick Quiz

1

What is encryption?

Encryption converts readable data into unreadable format to protect it.

Choose an answer to continue.

Interview Questions

Hashing is one-way (can't reverse). Encryption is two-way (can decrypt with key). Hashing for passwords, encryption for data protection.

Up next

Software Development Life Cycle

Lesson 12 of 17 · Software Engineering