The Affine Cipher

Introduction We will now tackle another encryption method called affine cipher. If by reading the word affine made you think of affine functions, you are already on the right track! This method uses an affine function to encrypt messages. Differently from the shift cipher that uses only addition, the affine cipher uses also multiplication, which makes our encryption more complex. If we recall how an affine function looks like, it takes an input $x$, multiply by a coefficient, $a$, and adds to a constant, $b$. ...

December 18, 2024 · 8 min · Bjørn

The Shift Cipher

Introduction In this post we will cover the shift cipher. Although it’s not the first known cryptographic method, it’s one that is very well documented and a great entry point to cryptography. This method makes use of modular arithmetic, so we will be able to put to use the knowledge we have so far. If you are not familiarized with modular arithmetic, I strongly recommend reading the post Introduction to Modular Arithmetic before proceeding. ...

December 14, 2024 · 7 min · Bjørn

Extended Euclidean Algorithm and Modular Inverse

Introduction The next topic we will cover in mathematics foundations is the Extended Euclidean Algorithm (EEA) and modular inverse. In the topic Introduction to Modular Arithmetic we discussed that division is tricky in modular arithmetic. Today we are going to tackle this problem and see how division works and when we can use it. But first, we need to talk about greatest common divisor and the Euclidean Algorithm. So let’s take this step-by-step. ...

December 4, 2024 · 14 min · Bjørn

Introduction to Modular Arithmetic

Introduction The best way to introduce the concept of modular arithmetic is with the clock analogy. We know a day has 24 hours (on Earth!). If now is 10:00 and someone says “Let’s meet in 30 hours” you don’t write down “Meeting at 40:00”, you would write down “Meeting at 16:00”. You just performed a modular arithmetic calculation! The easiest way I found to understand the concept of modular arithmetic was associating it with cycles. Anything we count in cycles (hours, days, weeks, and so on) is done using modular arithmetic! Modular arithmetic is used in many different cryptosystems, including modern ones still in use! We will move now to the formal definition that forms the basis of modular arithmetic. ...

December 3, 2024 · 11 min · Bjørn