Page 1 of 1

### My Encryption Algorithm

Posted: Sat Nov 10, 2012 4:04 pm
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

### Re: My Encryption Algorithm

Posted: Sat Nov 10, 2012 5:00 pm
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.

### Re: My Encryption Algorithm

Posted: Sat Nov 10, 2012 5:20 pm

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

### Re: My Encryption Algorithm

Posted: Sat Nov 10, 2012 6:01 pm
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.

### Re: My Encryption Algorithm

Posted: Sat Nov 10, 2012 6:29 pm
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

### Re: My Encryption Algorithm

Posted: Sat Nov 10, 2012 9:21 pm
No problem. Good luck with the hash.

### Re: My Encryption Algorithm

Posted: Sun Nov 11, 2012 11:59 am
Thank you

### Re: My Encryption Algorithm

Posted: Fri Jan 04, 2013 6:46 pm
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?

### Re: My Encryption Algorithm

Posted: Fri Jan 04, 2013 6:49 pm
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.