☰ Contents · Computing

Information security on the Internet and cryptography

Lessons 30 · 1 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 11, 1st edition. “Extremum-press”, Tashkent, 2018
30

Security problems of information stored on the Internet

Textbook: pp. 108–111
GoalExplains the basics of cryptography (encryption, key, symmetric and asymmetric methods, hash, electronic signature), runs the Caesar cipher in a program, calculates RSA with small numbers and applies rules for protecting personal data on the Internet.
New words
cryptography: the science of hiding the meaning of messages and checking their authenticity · kriptografiyasymmetric cipher: the same secret key encrypts and decrypts · simmetrik shifrpublic and private key: a key pair; one encrypts or verifies, the other decrypts or signs · ochiq va yopiq kalithash: a short fixed-length fingerprint of data; any small change makes it completely different · xesh
Explanation

On the Internet, data passes through many devices and servers, so it needs encryption. Cryptography studies methods of encrypting (turning plain text into ciphertext) and decrypting; a cipher must be unreadable without the key. One of the oldest examples is the Caesar cipher: each letter is moved k places along the alphabet. According to historical sources Julius Caesar used k = 3. This cipher can be broken by trying just 25 keys, so it is useless for real protection today, but it is handy for explaining the idea. Modern symmetric ciphers (for example AES) also encrypt and decrypt with one key, but the key is 128 or 256 bits long and the number of variants is astronomical. The problem of the symmetric method is delivering the key safely to both sides. The asymmetric method (RSA and similar) has a key pair: the public key is given to everyone, the private key stays with its owner. A message encrypted with the public key can be opened only by the private key. The idea of RSA: multiplying two primes is easy, but splitting the product back into its factors is very hard. The calculation: p and q are primes, n = p·q, φ = (p–1)(q–1), the public exponent e is coprime to φ, d is chosen so that (e·d) mod φ = 1; encryption is c = mᵉ mod n, decryption is m = cᵈ mod n. Real systems use n of at least 2048 bits; the small numbers here are only for understanding. The electronic digital signature works the other way round: the hash of a message is signed with the private key and anyone checks it with the public key; this shows the message was not changed (integrity) and who signed it. A hash function (for example SHA-256) makes a short “fingerprint” of any data. HTTPS in the browser combines both methods: the asymmetric method agrees on a key, then a fast symmetric cipher is used. Personal safety rules: do not post your address, phone number or a photo of a document openly on social networks; check privacy settings; every post leaves a “digital footprint” that is hard to delete; give a site only the data it needs; do not trust unreliable sources, and check information in 2–3 sources.

Worked examples
A Caesar cipher program (Python, tested): def sezar(matn, k): ⏎    natija = "" ⏎    for c in matn: ⏎        if "a" <= c <= "z": ⏎            natija += chr((ord(c) - 97 + k) % 26 + 97) ⏎        else: ⏎            natija += c ⏎    return natija ⏎ print(sezar("salom dunyo", 3)) ⏎ print(sezar("vdorp gxqbr", -3)) The program prints two lines: vdorp gxqbr and salom dunyo. With key 3, s → v and a → d; the reverse shift (–3) restores the text.
Small RSA: p = 5, q = 11, n = 5·11 = 55, φ = 4·10 = 40, e = 3, d = 27 (3·27 = 81 = 2·40 + 1). For the message m = 7, c = 7³ mod 55 = 343 mod 55 = 13. Decryption: 13²⁷ mod 55 = 7, so the original message is restored. If only the public (55, 3) is known, the attacker must split 55 into 5·11 – easy for a two-digit number. The 129-digit number RSA-129, published in 1977, was factored only in 1994, after about 600 volunteers ran hundreds of computers for 8 months; factoring today's 2048-bit (617-digit) numbers is practically impossible.
Class activity

“Secret message”: in pairs choose a key from 1 to 25, write a short message with the Caesar cipher and give it to your partner, who opens it without knowing the key by trying the 25 options. Discuss why this cipher is not enough for modern protection.

Practice
1
With a Caesar shift of k = 4, how is the word “ilm” encrypted?
2
If n = 11·13, find n and φ = (11–1)(13–1). Write φ.
3
Write the main difference between symmetric and asymmetric encryption.
4
Why is it risky to post your home address and a photo of a document openly on social networks? Write two reasons.