How Timi Used Encryption, Hashing, and Salting to Send a Secret Message

View profile for Alonge Daniel

Cybersecurity Analyst | Threat Intelligence, SIEM, ISO 27001 | SOC 2 | PCI DSS | Securing Finance & Tech Systems

Timi and the Secret Message A Cybersecurity Story About Hashes, Encryption and Salting. Timi, a clever boy with a love for secrets Inside his laptop were treasures: Grandma’s cake recipe Cheat codes for his favorite game One day, Timi wanted to send a message to his best friend, Zainab, without anyone else reading it. But how? Timi’s big brother, a cybersecurity wizard, said: “You need encryption, little bro. It’s like locking your message in a box so only the right person can open it.” Timi’s eyes lit up. “Cool! But how do I lock it?”. Big bro explained there are two kinds of locks in the digital world: Symmetric Encryption: One key to lock, The same key to unlock, Fast and simple, "It’s like using the same house key for you and Zainab. But if someone steals the key… uh-oh!” Asymmetric Encryption: One key to lock (public key), A different key to unlock (private key) Super secure "It’s like sending Zainab a locked box, but only she has the magic key to open it. Even you can’t peek!” Big bro opened his spellbook and told the story of the Two Magic Keys: Once upon a time, every cyber hero had two keys: The public key was shared with everyone. It could lock messages but not unlock them. The private key was kept secret. Only the owner could use it to unlock messages. Timi used Zainab’s public key to lock the message, Zainab used her private key to unlock it. Even if Mr. Byte the sneaky hacker saw the public key, he couldn’t open the box, Only Zainab could because only she had the private key. Before sending the message, Timi added a hash a special fingerprint of the file. “A hash is like sealing your letter with a wax stamp,” said Big bro. “If someone changes even one word, the stamp breaks! Timi used SHA-256, a strong hashing algorithm that creates a 256-bit fingerprint long, unique, and irreversible. sha256sum secret_message.txt Timi asked, “Can someone take the hash and figure out my message?” Big bro smiled. “Nope! Hashing is one-way magic. Once you turn a file into a hash, you can’t turn it back.” It’s like blending a smoothie: You can see what it looks like. But you can’t un-blend it to get the banana and mango back. Big bro leaned in and whispered: “But wait there’s one more trick: salting.” Timi blinked. “Like jollof rice?” “Exactly! Just like adding salt makes your recipe unique, salting a hash adds a random twist that makes it harder for hackers to guess.” Timi added a salt to his hash: echo "secret_message.txtmysalt123" | sha256sum Now the hash was totally different even though the message hadn’t changed. Zainab received the locked box and used her private key to open it. She scanned the file and ran the same salted SHA-256 hash command: echo "received message. txtmysalt123" | sha256sum She compared the result with Timi’s original salted hash. The hash matched, the message was untouched, the cake recipe was still delicious This means no one changed the file,” she smiled. “It’s still pure!” #CyberSecurity #infosec

To view or add a comment, sign in

Explore content categories