Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: my encryption algorithm

1. ## my encryption algorithm

I made a really trashy encryption algorithm... which basically fully screws up the password entered and has no way of decoding(which i know isn't true)

Does anyone mind checking how reliable this trasher is...
source:
PHP Code:
``` public class Encrypt {     public static String encrypt(String pass)     {         char[] passc = pass.toCharArray();         double passsum = 0;         double passmul = 1;         double passdiv = 1;         double passsub = 0;         double finalpass = 0;          String passcode = "";         for (int i = 0; i < passc.length; i++)         {             passsum = passsum + (int)passc[i];         }         for (int i = 0; i < passc.length; i++)         {             passmul = passmul * ((int)passc[i] + 1);         }         for (int i = 0; i < passc.length; i++)         {             passdiv = passdiv / ((int)passc[i] + 1);         }         for (int i = 0; i < passc.length; i++)         {             passsub = passsub - ((int)passc[i]);         }         passcode = passsum + " " + passsub + " " + passdiv;         String finalPass = "";         char[] code = passcode.toCharArray();         if (code.length % 2 != 0) {             code = (passcode + code[0]).toCharArray();         }         for (int i = 0; i < code.length; i+=2)         {             double charSum = 0;             charSum = charSum + (int)code[i] + (int)code[i+1];             finalPass += (char)charSum;         }         return finalPass;     } }  ```
It's an algorithm that just popped into my head, i really didn't read anything about encoding before so... I'm hoping this is at least somewhat reliable...

my idea is that there is no need to decode the awkwardness of a password, i just compare the 2 encoded strings

this is intened to work with 20 characters MAX, i know that if it's too many it'll cause the 'infinity' result.

Just if you have spare time, try to crack it :|

2. Hey homes...
If you want to try and test the reliability of this garbage expandomachine you need to check for the rate of collisions.
A collision is when you can put two different things in and get the same thing out.
Usually these are bad and you want to minimize them but I don't know exactly what your plans are so maybe its not that important.
Also, because you're summing and multiplying, you're creating primitive hashes and they can't be reversed...easily.

Anyway to check for collisions, just make an array of the output, and everytime you add new input, check the output to see if it is already present in the output array. If it is already there, you have a collision. If you get one collision out of 1000000 inputs... it's not so bad, any more, then it's not a very reliable algorithm.

3. so basically i make an arraylist object, and do the following

basically make random words: {some kind of algorithm that generates words of length 1 to 20 with word changing slightly allowing every possible input}

a letter can contain 26 one of characters
a password concists of 20 letters at most

you loop through possible inputs and add the awkward strings into the arraylist(unless it already exists, in which case you add collision)

or is there something that already exists that will do that for me?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•