Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder DELOCH's Avatar
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    537
    Thanks
    4
    Thanked 2 Times in 2 Posts

    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 0passc.lengthi++)
            {
                
    passsum passsum + (int)passc[i];
            }

            for (
    int i 0passc.lengthi++)
            {
                
    passmul passmul * ((int)passc[i] + 1);
            }

            for (
    int i 0passc.lengthi++)
            {
                
    passdiv passdiv / ((int)passc[i] + 1);
            }

            for (
    int i 0passc.lengthi++)
            {
                
    passsub passsub - ((int)passc[i]);
            }

            
    passcode passsum " " passsub " " passdiv;

            
    String finalPass "";
            
    char[] code passcode.toCharArray();

            if (
    code.length != 0) {
                
    code = (passcode code[0]).toCharArray();
            }

            for (
    int i 0code.lengthi+=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
    Regular Coder
    Join Date
    Jun 2008
    Posts
    102
    Thanks
    6
    Thanked 9 Times in 9 Posts
    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
    Regular Coder DELOCH's Avatar
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    537
    Thanks
    4
    Thanked 2 Times in 2 Posts
    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
    •