← Computer Science
1 / 1
← → move  F fullscreen  Esc read

Fundamentals · Lesson 1

Digital Safety and Secrets

Become a hard target, then learn how to actually keep a secret

You already own things worth stealing. Not your phone. Your accounts, which someone can resell in bulk without ever meeting you. Over two days you will make your passwords genuinely expensive to crack, switch on the one setting that stops most break-ins cold, learn to spot a fake message that has perfect spelling, and find out how programmers keep secrets out of code they put on the internet. That last part is why you will not accidentally publish a password in every project you build this year.

What you'll learn

What you need

Day 1

Lock down your accounts

Day 1 start
  1. Nothing to set up. You only need this page. Do not log in to anything in class.
  2. Work down the page in order. Each step ends with a green Checkpoint. Do not skip ahead until you can tick it.
  3. Never type a real password into any tool on this page. Type something similar.

Goal: by the end of today you have three passphrases you can actually remember, a plan for where to keep the rest, two-factor authentication switched on somewhere real (at home, or the in-class version), and the ability to look at a message and say why it is fake.

Step 1: Watch a bad password die

Every year, security researchers publish the most common passwords found in leaked databases. Every year, it is basically this list. People are wonderfully predictable.

RankPasswordTime to crack
1123456under a second
2passwordunder a second
3qwertyunder a second
4abc123under a second
5Your birthdayminutes to hours

Nobody is sitting at a keyboard typing guesses at your account. They run software against a stolen list at millions of tries per second. Anything on that table fell over before you finished reading this sentence.

Test one yourself

Never type a password you actually use, here or anywhere else. Type something similar. This page sends nothing anywhere, but that is a promise you cannot verify on someone else's site, so build the habit now.

Try password1, then your pet's name and a year, then a whole sentence. Then mash your keyboard for forty characters. It holds up, and you will never remember it. Keep that thought. There is a well known public version of this at security.org, worth bookmarking for the day you set up something that matters. Same warning applies there.

Checkpoint: you have made it say Instant and you have made it say Centuries.

Step 2: Build a passphrase

Length beats cleverness. Every character you add multiplies the work, and multiplying gets out of hand fast, which is the one time that works in your favor.

Random charactersTime to crack by brute force
6 charactersseconds
8 charactershours
12 characterscenturies
16+ characterseffectively impossible

Six random words does it. Attackers who know you used words guess whole words, not letters, so each word counts as one guess from a big list. Four words falls in hours. Five takes years. Six takes centuries. Random is the load-bearing word here, because saint-croix-high-school is four words and still weak. Anyone who knows you would guess it.

Do this: generate three, test each in the meter above, and write down the crack time. Those three go in your submission.

Checkpoint: three passphrases written down, each showing centuries or longer.

Why length beats symbols

Schools and websites spent twenty years demanding a capital, a number, and a symbol. What they got was Password1!, roughly two hundred million times. Everyone follows the rule the same lazy way, so attackers just try the lazy way first.

Picture a combination lock. Symbols give you more numbers on each dial. Length gives you more dials. Adding a dial multiplies everything that came before it, which is why length wins and it is not close.

Six random words give you enough dials that no computer on Earth gets through in your lifetime, or your grandchildren's. A long phrase you can actually remember beats a short scramble you end up writing on a sticky note under your keyboard, which is where roughly half of all strong passwords go to die.

Where do you keep all of these?

Three strong passphrases is easy. Forty accounts is not. Nobody can memorize forty, so people reuse one password everywhere. Then one leaked website opens every account at once, because attackers try each stolen password on every other site. That has a name, credential stuffing, and it is why reuse is the worst habit on this table.

WhereVerdictWhy
In your head, for 2 or 3 accountsGoodYour email and your password manager. The ones that unlock everything else
A password managerBest for the restOne strong passphrase unlocks a vault that makes and remembers a different password for every site
Paper, in a drawer at homeFineNot on your monitor. A burglar is a much smaller risk than a hacker
A note on your phone called “passwords”BadAnyone who gets into that account or that phone gets everything, in plain text
The same password everywhereWorstOne leak, every account
On a school or lab computer, never save a password. When the browser offers, click Never or the X. It is not your computer, and the next person who sits down can use whatever it saved. Log out when you finish.

What a password manager actually does

Not required, not graded, and not for school computers. If you want one, set it up at home with a parent or guardian. The easy start needs nothing new: the password manager already built into Chrome, Edge, Safari or Firefox, or Apple Passwords. Bitwarden is a free dedicated one. Check the age rule before you sign up for anything. Bitwarden and Google accounts both require you to be 13 or older (checked October 2026).

Step 3: Make a stolen password useless

Two-factor means logging in takes two things: something you know (your passphrase) and something you have (your phone, or an app, or a key). Someone who steals your password still cannot get in.

MethodSecurityHow it works
Text message codeGoodA code is texted to your phone
Authenticator appBetterAn app generates a code that changes every 30 seconds
Hardware keyBestA physical device you plug in
Fingerprint or faceGoodYour device confirms it is you

Text codes are the weakest of the four because of SIM swapping, which you will read about in a moment. They are still far better than nothing.

Turn it on somewhere that matters. Email first if you can, because password resets for everything else land there.

Step 3b: Turn it on, at home

Phones stay away in class. Turning on two-factor needs your own phone and your own account, so do the real thing at home tonight. Short on time or no phone at home? The next slide has an in-class version.

At home · the real thing

  1. Open your email account's security settings.
  2. Find two-factor authentication. The name changes by site, so look for “2-step verification” or “two-factor”.
  3. Turn it on.
  4. Screenshot the confirmation with anything private blurred.
Checkpoint: a screenshot showing two-factor is on, private details blurred.

Step 3c: The in-class version

No phone needed. If you did the home version, you can skip this and keep going. Tap an answer to see why.

A stranger has your password. What stops them getting in?

Step 3c: Question 2

Which of these is the weakest way to get a code?

Checkpoint: both questions answered.

Step 4: Spot the phish

Phishing is someone pretending to be a company or a person you trust so that you hand something over. This is how people actually get hacked. Nobody is in a dark room breaking your encryption with a progress bar. They just asked, politely, while wearing a costume.

Terrible spelling used to give these away for free. AI ended that overnight. So stop judging the writing and start checking the structure.

Now work the inbox

Eight messages. Open each one and decide.

Checkpoint: all eight judged. Screenshot your score, you submit it.

Before you leave today

A progress check, not the hand-in. The full submission list is in the Turn in tab.

Day 2

Protect your data and your code

Day 2 start
  1. Nothing to set up for the main lesson. Photos, voices and the secrets rule are all on this page.
  2. The VS Code part is a bonus. Only open VS Code if you want it. If you already made secret-test last time, use File → Open Recent to get back to it.

Goal: by the end of today you know what you are giving away without meaning to, and you know where a password belongs in a project you are going to share.

Step 1: What your photos tell strangers

Here is what someone builds from pieces that each feel harmless.

What they getWhat they do with it
Full name and birthdayOpen accounts in your name
Email and passwordGet into your other accounts, then message your friends as you
Phone numberSIM swap, taking over your number and every code sent to it
School or workplaceWrite a phishing message convincing enough to fool you
Location, liveKnow when your house is empty

Check the background of a photo for a house number, a street sign, a school logo, a license plate, a package label, or a screen with a name on it. You can practice two ways. In class, use the photo on the next slide. At home, look through the last five photos you posted or sent, without opening anything private.

The rules that follow are short. Keep profiles private. Post the vacation photos after you get home. Check the background before you post. Ask whether you would be fine with a stranger, a teacher, and an employer all seeing it.

Checkpoint: you found at least one identifying detail in the background of a photo, the class photo or one of your own.

Step 1b: Spot the details

Jordan posted this photo today with the caption “new hoodie!” Click everything in it that tells a stranger something about Jordan. Not everything counts.

Welcome, Jordan jordanb.2010@mail.com MANGO LN VI 4821 J. BAPTISTE 27 MANGO LN 27 WESTSIDE TRACK Live location: at home, just now

Step 2: Assume the voice can be faked

A few seconds of audio is enough to clone a voice. Video of a real person saying things they never said is cheap now. A profile photo of a person who has never existed takes one click.

You cannot win this by squinting harder. The fakes improve every year and your eyes have not had an upgrade since you were born. So the defense has to be a habit rather than a skill.

Verify through a different channel. A call from a panicked family member asking for money gets hung up on and called back on the number you already have. A message from a friend asking for a code gets a text to that friend. A news claim gets checked against a second source you went and found yourself.

This one habit covers voice cloning, deepfake video, hacked accounts, and every scam that has not been invented yet, because it never depends on you detecting the fake.

Step 3: What actually counts as a secret

A secret is any value that proves who you are to a computer. A password. An API key. A Wi-Fi password. A database login. A token an app uses to talk to a service.

Here is the problem, and it is the reason this sits in a Computer Science class instead of a health class.

# BAD. Never do this.
api_key = "sk-a83ff20c9d4e1b77c5"

response = ask_the_ai(api_key, "explain recursion")

That key now lives inside your code, and it travels everywhere the code travels. Post the project to GitHub and the key is public. Share the folder with a partner and they have your key. Submit a screenshot and the key is in the picture. Bots scan public code for keys around the clock, and people have woken up to four figure bills from a key they published before dinner.

Putting a key in your code is like taping your house key to your front door, then posting a photo of your door, then being surprised.

The rule: the code goes in the file you share. The secret goes in a file you never share.

Step 4: Put the secret somewhere safe

A .env file holds the secrets. It sits next to your code and it never leaves your machine.

Base · everyone

app.py

import os
from dotenv import load_dotenv

load_dotenv()
api_key = os.getenv("API_KEY")

.env

API_KEY=sk-a83ff20c9d4e1b77c5

So which one is safe to post?

Optional bonus: build it yourself

This part is optional, for high school and middle school. It is a bonus, not a requirement. You need VS Code for it, so if you do not have VS Code, skip ahead to “Before you leave today”. You lose nothing by skipping it.

If you have never opened a terminal before, that is fine. This is written for exactly that.

What a terminal is, in one sentence. A window where you type commands instead of clicking things. That is the whole idea. You are going to type two commands in it.

We do all of this inside VS Code, which is already on the lab machines, because VS Code lets you make files whose names start with a dot. Finder and File Explorer both fight you on that, and it is the single most annoying part of this for beginners.

Step A: Make a folder and open it

  1. Open VS Code
  2. Go to File → Open Folder
  3. Navigate to your Desktop, make a New Folder called secret-test, and open it

The left sidebar should now say SECRET-TEST and be empty underneath.

Checkpoint: VS Code is open and the sidebar shows an empty folder called SECRET-TEST.
If VS Code asks whether you trust the authors of the folder, click yes. It is your own folder that you just made.

Step B: Make three files

For each one, hover the sidebar and click the New File icon, then type the name exactly, including the dot at the front where there is one. Then click Copy on the box below, click inside the file, and paste.

.env   (the secret. Note the dot.)

API_KEY=not-a-real-key-12345

.gitignore   (the part everyone forgets. Also a dot.)

.env

read_secret.py   (the code. No dot at the front.)

import os
from dotenv import load_dotenv

load_dotenv()
print("Loaded key:", os.getenv("API_KEY"))
Checkpoint: three files in the sidebar. Save each one with Cmd+S or Ctrl+S. A white dot on the tab means unsaved.

Step C: Open the terminal

In VS Code, go to Terminal → New Terminal. A panel opens at the bottom.

It already starts inside your secret-test folder, which is the reason we are doing it this way. You never have to learn how to navigate folders from a command line today.

Check Python is there. Click Copy, click inside the terminal, paste (Ctrl+V, or Cmd+V on a Mac), then tap the Enter key:

python3 --version

You want something like Python 3.12.1. Any 3 is fine.

If it says command not found, try python --version instead, and use python in place of python3 for the rest of this. If neither works, put your hand up.
Checkpoint: the terminal printed a Python version number.

Step D: Install the one library you need

Your code says from dotenv import load_dotenv, which is you borrowing somebody else's code. It has to be on this machine first.

pip3 install python-dotenv

You will see several lines scroll past. The one you want at the end is:

Successfully installed python-dotenv-1.x.x
Already satisfied instead means somebody installed it on this machine before you. That counts. Carry on.
If pip3 is not found, try pip install python-dotenv, then python3 -m pip install python-dotenv. One of the three works.
Checkpoint: the terminal said Successfully installed, or already satisfied.

Step E: Run it

python3 read_secret.py

What you are looking for:

Loaded key: not-a-real-key-12345

Now look back at read_secret.py. The key is printed on your screen, and the key is nowhere in that file. That is the entire point, and you just built it.

Checkpoint: your terminal printed the key. Screenshot the terminal, and screenshot your .gitignore. Those two are your optional bonus hand-in.

If it did not work

Every one of these is normal and every one of them has a two second fix.

What you sawWhat it means
Loaded key: NoneThe file is not being found or read. Usually the name is .env.txt, or there are spaces around the =. It must read API_KEY=value exactly.
ModuleNotFoundError: No module named 'dotenv'Step D did not finish. Run the install again and read the last line.
can't open fileThe terminal is not in your folder, or the filename is spelled differently. Check the sidebar for the exact name.
Nothing happens at allYou probably did not tap the Enter key, or the file was never saved. Look for a white dot on the tab.
Getting an error is not failing. Reading the last line of an error and acting on it is the actual skill. You will do this for the rest of your life in this subject.

Watch one line save you $400

Same project, pushed twice. The only difference is whether .gitignore exists.

Checkpoint: you have run it both ways and seen the key appear in one and not the other.

Why .gitignore is the part people forget

load_dotenv() reads the .env file and hands the values to your program at the moment it runs. Your code asks for API_KEY by name and never contains the value.

.gitignore is the second half, and skipping it is the single most common way keys leak. It is a list of files Git refuses to include when you save or upload your work. Without that one line, the moment you push your project the .env goes with it, and everything you just did was for nothing.

Real companies leak real keys this exact way, constantly, with entire security teams on payroll. This is not a beginner mistake. It is the mistake.

Before you leave today

A progress check, not the hand-in. The full submission list is in the Turn in tab.

Base and optional bonus

Base · everyone

Three passphrases with crack times, two-factor authentication turned on with a screenshot, the phishing red flag identified, and the three secret-handling questions answered correctly.

Optional bonus · HS and MS

A working .env setup: the .env file, a .gitignore containing it, and a script that prints the key without the key appearing anywhere in the script. Screenshot the terminal output. Not required for anyone. It needs VS Code.

What you turn in

The whole list. Every item comes out of an activity you already did. Optional bonus, HS and MS: your terminal screenshot and .gitignore from the Day 2 VS Code part. Skipping it costs you nothing.

Tick the boxes as you go. This page remembers them on your own device. The next screen shows exactly how to hand it in.

Handing it in

Two things to hand in, not one

1 · The assignment

Everything on the previous screen goes here, as file uploads.

  1. Open Digital Safety and Secrets in Schoology
  2. Click Submit Assignment
  3. Click Upload
  4. Select all your files at once, then Submit
Do not click "Create". Create is for typing text and will not let you attach a screenshot. Upload is the one you want. This is the single most common way work gets lost.

2 · The exit ticket

A separate item in Schoology, taken in class. It is a short quiz on this lesson, and it is graded on its own.

You can submit the assignment and take the exit ticket in either order, but both have to be done.

Name your files so they make sense. passphrases.png tells Mr. Krigger what he is opening. Screenshot 2026-09-14 at 9.03.11 AM.png does not.

Vocabulary

TermWhat it means
PassphraseSeveral unrelated words stuck together, long enough that guessing it is hopeless and short enough that you remember it
Two-Factor AuthenticationNeeding two different proofs to log in, usually a password plus a code on your phone
PhishingPretending to be someone trustworthy to trick you into handing over information
Social EngineeringAttacking the person instead of the computer, because the person is easier
SIM SwapStealing someone's phone number so that every security code sent to it lands on the attacker's phone
Data BreachA company's stored logins getting stolen
DeepfakeVideo or audio of a real person, generated by AI, showing something that never happened
SecretAny value that proves identity to a computer: a password, an API key, a token
API KeyA string that identifies your account to an outside service, usually attached to money or private data
.env fileA file holding secrets, kept next to your code and never shared
.gitignoreA list of files Git flatly refuses to upload. One line in it is the difference between a private key and a public one.
Brute ForceTrying every possible combination until one works, which is fast when your password is short and hopeless when it is long

When it goes wrong

My school account will not let me turn on two-factor.
It is school managed and locked down, which is IT doing its job. Use a personal account instead. Anything you actually control counts.
I do not want to screenshot my real account.
Blur everything except the confirmation that two-factor is on. That is all that is being checked.
The checker says my passphrase is weak.
Your words are related to each other, or to you, or to something on your desk right now. The meter cannot tell, but anyone who knows you can. Use the generator, or pick words that have no business being in the same sentence.
pip install python-dotenv says pip is not found.
Try pip3 install python-dotenv, or python3 -m pip install python-dotenv.
My script prints "Loaded key: None".
Three suspects, in order of guilt. The file got saved as .env.txt instead of .env, the file is in a different folder from the script, or you put spaces around the =. It has to read API_KEY=value with nothing breathing in between.
I cannot see the .env file in my folder.
Anything starting with a dot is hidden, which is the whole idea. On Mac press Cmd Shift . in Finder. On Windows turn on hidden items in the View tab.
I do not have anything worth stealing.
Your accounts sell in bulk, and your identity is worth more than your accounts. Your phone number by itself can reset logins you have completely forgotten you own. You are not the target. You are inventory, and inventory is easier.