by not_essence2 on Sat Nov 10, 2012 6:01 pm
([msg=70703]see Re: My Encryption Algorithm[/msg])
Oh God. You're going to want a calculator for that.
Here's how modular addition (modulo) works:
For example, in normally taught math, 2+5=7.
However, in modulo 7, 2+5=0.
Here's how it works: x+y=z (modulo w). You first add x and y to get what z is. Then, divide it by w, and get the remainder. That's what the sum is. So for example, my previous example: 2+5 (modulo 7)
Would equal: 7 (modulo 7)
7/7=1 Remainder 0
So therefore 2+5 (modulo 7) equals 0.
The real concept, however, is that modulo 7 (often abbreviated as mod, not modulo) is basically like a clock with the numbers 0-6. When you add 2 numbers, it goes around the clock: 2+5 is starting from 2 on the clock then going 5 forward (3,4,5,6,7). When you get to 7, you basically went all around the clock, and so you really go from 6 to 0, not 6 to 7. So therefore 2+5 (modulo 7) is 0.
This is also why modular addition is used in hashes so much. If you get the modulo 7 sum of something like 2+5, which is 0, the original operation could've been 2+5, 6+1, 2+3+4+5, etc. If those numbers are the numerical values of the message you're hashing, it would be impossible to get the original message as there are an infinite amount of combinations, which is why they use modular addition in hashes so much.
However, it should obviously be more complicated than a simple modulo, as there would be WAY too many colliding hashes.