## My Encryption Algorithm

The fear of every surveillance society: citizens protecting their own privacy with strong cryptography

### My Encryption Algorithm

Hi everyone!
I'm making my own encryption algorithm. It's hash algorithm. I haven't made the code yet I'm working on algorithm now.
I used XOR logical operation. It gives 64 bit(8 characters) output. It's irreversible. I heard that most of hash algorithms using the XOR operation. So I'm asking that is there anyway to make it more secure? Which logic operation is most secure do you think? Should I combine two or three operations in my algorithm? I really need your suggestions.
Thank you anyway
"Ömür dediğin üç gündür, dün geldi geçti yarın meçhuldür…O halde ömür dediğin bir gündür,o da bugündür…."

barneystinson19
Experienced User

Posts: 50
Joined: Fri Nov 02, 2012 3:49 pm
Blog: View Blog (0)

### Re: My Encryption Algorithm

Welcome to HTS barney,

First off, a hash algorithm isn't an encryption algorithm. An encryption algorithm indicates a corresponding decryption algorithm, while a hash algorithm is not supposed to have any decryption algorithm or else it is weak.

Second, if you want a good hash algorithm, make sure it generates large, and very different keys. If you input a string once and then once more with just one letter different, it should give you radically different results. It should also have no collision of hashes (i.e. there shouldn't be 2 different strings with the same hash). As for operations, XOR is good, but it is easily reversible. An operation that I see used in nearly all good hashes these days is addition modulo 256.

When you're finished, feel free to post it up for review.

Contributor

Posts: 686
Joined: Tue Mar 06, 2012 9:37 pm
Blog: View Blog (0)

### Re: My Encryption Algorithm

First off, a hash algorithm isn't an encryption algorithm. An encryption algorithm indicates a corresponding decryption algorithm, while a hash algorithm is not supposed to have any decryption algorithm or else it is weak.

Second, if you want a good hash algorithm, make sure it generates large, and very different keys. If you input a string once and then once more with just one letter different, it should give you radically different results. It should also have no collision of hashes (i.e. there shouldn't be 2 different strings with the same hash). As for operations, XOR is good, but it is easily reversible. An operation that I see used in nearly all good hashes these days is addition modulo 256.

When you're finished, feel free to post it up for review.

Thank you and thanks for your suggestion
Sorry for my mistake It's a hash algorithm
How addition modulo 256 works exactly? I'm searching about it but I can't understand very well because my english is my foreign language. Can you explain it simply please? Thank you Btw I'll post it when it's finish
"Ömür dediğin üç gündür, dün geldi geçti yarın meçhuldür…O halde ömür dediğin bir gündür,o da bugündür…."

barneystinson19
Experienced User

Posts: 50
Joined: Fri Nov 02, 2012 3:49 pm
Blog: View Blog (0)

### Re: My Encryption Algorithm

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.
not_essence2
Poster

Posts: 189
Joined: Fri Sep 14, 2012 6:09 pm
Blog: View Blog (0)

### Re: My Encryption Algorithm

not_essence2 wrote: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.

Thank you so much that really helped me. What modulo I need to take in algorithm? The ASCII of letters?
I don't know if I did expression myself clearly :/

-- Sat Nov 10, 2012 7:19 pm --

Oohh I get it now. I readed some documentary in my main language your comments also helped alot thank you!
I'll post the program on forum when its done to test it. Thank you again
"Ömür dediğin üç gündür, dün geldi geçti yarın meçhuldür…O halde ömür dediğin bir gündür,o da bugündür…."

barneystinson19
Experienced User

Posts: 50
Joined: Fri Nov 02, 2012 3:49 pm
Blog: View Blog (0)

### Re: My Encryption Algorithm

No problem. Good luck with the hash.
not_essence2
Poster

Posts: 189
Joined: Fri Sep 14, 2012 6:09 pm
Blog: View Blog (0)

### Re: My Encryption Algorithm

Thank you
"Ömür dediğin üç gündür, dün geldi geçti yarın meçhuldür…O halde ömür dediğin bir gündür,o da bugündür…."

barneystinson19
Experienced User

Posts: 50
Joined: Fri Nov 02, 2012 3:49 pm
Blog: View Blog (0)

### Re: My Encryption Algorithm

barneystinson19 wrote:

First off, a hash algorithm isn't an encryption algorithm. An encryption algorithm indicates a corresponding decryption algorithm, while a hash algorithm is not supposed to have any decryption algorithm or else it is weak.

Second, if you want a good hash algorithm, make sure it generates large, and very different keys. If you input a string once and then once more with just one letter different, it should give you radically different results. It should also have no collision of hashes (i.e. there shouldn't be 2 different strings with the same hash). As for operations, XOR is good, but it is easily reversible. An operation that I see used in nearly all good hashes these days is addition modulo 256.

When you're finished, feel free to post it up for review.

Thank you and thanks for your suggestion
Sorry for my mistake It's a hash algorithm
How addition modulo 256 works exactly? I'm searching about it but I can't understand very well because my english is my foreign language. Can you explain it simply please? Thank you Btw I'll post it when it's finish

I have a unique algorithm. So far no one has cracked the code. Would anyone like to see if they can crack it?
Agent_232
agent_232
New User

Posts: 1
Joined: Fri Jan 04, 2013 6:33 pm
Location: US
Blog: View Blog (0)

### Re: My Encryption Algorithm

agent_232 wrote:
...

I have a unique algorithm. So far no one has cracked the code. Would anyone like to see if they can crack it?

what type of an algorithm is it? A hash? An encryption scheme? and define crack. Do you mean find way to generate collisions in a hash? Or view the PT of an encrypted message, or what?

If you can answer those questions, then yes, we would love to try.