Math and
All Math
How Math
Helped Me
Lesson 1  Lesson 2  Lesson 3  Lesson 4  Lesson 5  Lesson 6  Lesson 7

Lesson 3 - Improved 2-Letter Shift Encoding Program For Words Up To 8 Letters Long

Note: To use the Javascript programs in these lessons, you will need to use a FireFox browser or other non-Internet Explorer browser due to the "feature" in the IE browser disallowing Javascript prompts.

To understand the basics of how this encoding program works, you should first read through the Simple 2-Letter Shift Encoding Program page and also try out the Simple Letter Shift Code Creator and read through the documentation on the Code Creator page.

The Problem With The Old Formula
In the simple 2-Letter Shift, each letter was assigned a number and then the number was increased by 2.  The new number was then reassigned back to a letter.  Basically, the equivalent of the function y = x + 2 was used. The problem with this formula was that the letters Y and Z were assigned the values 25 and 26, which were then increased to 27 and 28.  27 and 28 could not be reassigned to any letter.  In essence, our function y = x + 2 did not have an inverse for all x-values.  When this is the case we say the function is not one-to-one.

A New Formula That Provides a Solution!
Instead of simply adding 2, we need to add 2 and then apply modular arithmetic. In modular arithmetic, you divide by the modular base and the remainder after dividing is your answer.  We use modular arithmetic in base 12 nearly every day.  For example, if it is 10:00 now, in 4 hours it will be 2:00. To get 2:00, we are adding 4 to 10 to get 14 and then using the modular base of 12 to get 2 since 14 12 has a remainder of 2.  We would writhe this as

2 = (10 + 4)(mod 12)

In our coding example we use the new formula

y = (X+2) (mod 26)

This means that when we increase "Z" by 2, it's numerical equivalent does not become 28, but rather the remainder of the division  28 26, which is 2.

Modular Arithmetic and Abstract Algebra
Modular arithmetic is something covered in great depth in Abstract Algebra, a generalized math course taken mostly by math majors and graduate students at the college level.  Also, the concept of one-to-one is studied in depth in an Abstract Algebra course as well.

Can You See Why This Code Would Be Easy to "Break"
This coding scheme is very easy to break.  Try out this code generator and find why.









Copyright 2021, Michael Sakowski and His Licensors
News on My Blog! Share Your Ideas! Copyright Info Suggested Uses Links Contact FAQs