#499 How does computer encryption work?

How does computer encryption work?
Photo by luis gomes: https://www.pexels.com/photo/close-up-photo-of-programming-of-codes-546819/

How does computer encryption work? Most computer encryption works by using prime numbers.

What is computer encryption? It is basically a form of code. There have been many different types of code throughout history and they have slowly grown more and more complex. A Caesar cipher is a good example. If you take the word “hello” and shift all of the letters of the alphabet by three places, you get “khoor”. If someone managed to intercept a letter written in this code, they wouldn’t be able to read it. If they knew that the key to the code was “3”, they could undo the cipher. This is a simple code. An example of a more complex code was the enigma machine used by the Germans in World War II. It had four rotors that would randomly turn when a key on a keyboard was pressed, putting out a random letter instead of the one pushed. If the receiving machine could be set to the same setting, it would undo the code and turn the gibberish into a message.  The receiving device had to be set to the same setting and that setting was the key.

Computer encryption needs to be a little more complex than that. If a modern computer was able to work within the parameters that the people who broke the Enigma Machines transmissions in the Second World War had, it would crack the message in seconds. However, to brute force crack it would probably still be impossible for a regular computer. A brute force attack is when the computer tries every single combination of letters or numbers until it gets it right. An example of that would be if a computer tried to crack a password that was eight characters long. If the password used lowercase, uppercase, numbers, and symbols, there would be 95 possibilities for each space. A computer would try every combination until it got it right. A powerful computer can check 1 billion passwords a second.

Computers are becoming more powerful year by year. The computer that was built to crack the enigma machine could do about 15 calculations a second. Modern computers have processors of 4 GHz and above, which means they can do 4 billion calculations a second. Processing power is increasing so encryption needs to keep ahead of it. This is why computer encryption uses prime numbers.

A prime number is a number that is divisible only by 1 and itself. For example, 13 is a prime number because it can only be divided by 1 and 13. 12 is not a prime number because it can be divided by 1, 2, 3, 4, 6, and 12. To work out if something is a prime number, you just have to divide it by every number that is lower than the number itself and see if they are divisible without a remainder. If there are no numbers that you can divide it by, it is a prime number. That’s easy if the number is 13. It’s more difficult if the number is 5,915,587,277. (It is a prime number.) A computer can calculate if a ten digit number is a prime number or not in less than a second.

So, what do prime numbers have to do with encryption? When you are sending secure data, the encryption program you use will encrypt the data and lock it. The lock on the data will be a staggeringly long number that is the result of multiplying two prime numbers together. The two prime numbers that were multiplied are the key and both you and the person you are sending the data to possess that key. When the other person receives the data, their software inserts the two prime numbers as the key. The computer multiples the two numbers and if it gets the correct result, the date unencrypts. For example, let’s say the lock is 21. You can multiply 3 and 7, both of which are prime numbers, to get 21. 3 and 7 would be the key. The staggeringly long prime numbers used in encryption are generally 1024 bits long, which is about 308 digits. There are two numbers, which gives 2048 bit encryption. When your computer receives the data, it has no trouble multiplying two 308 digit numbers together and checking them against the lock.

Anybody who intercepts the data can see the lock. In our example, that was 21. However, they’ll have to work out the prime numbers themselves to open it. That means working out every possible set of numbers that could be multiplied together to make the lock number and then calculating if those numbers are prime numbers. That is a ridiculously time-consuming operation. It would take the computer I am writing this on about 300 trillion years to be able to perform all of those calculations, making our data safe.

Quantum computers are giving people who make encryption software the jitters. Regular computers work with 1s and 0s. They can do it a billion times a second, but they can only be 1 or 0. A quantum computer can be one, zero, or both one and zero, all at the same time. A quantum computer could theoretically crack the code that took my computer 300 trillion years in about 8 hours. And that is what I learned today.

Source

https://nordpass.com/blog/brute-force-attack/

https://the-axiom.uk/how-long-would-it-take-you-to-crack-the-enigma-machine

https://en.wikipedia.org/wiki/Cryptanalysis_of_the_Enigma

https://brilliant.org/wiki/caesar-cipher/

https://cloud.google.com/learn/what-is-encryption

https://mashable.com/article/why-should-we-care-about-prime-numbers

https://www.livescience.com/34526-prime-numbers.html

https://www.splashlearn.com/math-vocabulary/multiplication/factor