Thread: Possible to mathematically reverse this? (Challenge)

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1 Possible to mathematically reverse this? (Challenge) 
    Registered Member Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,480
    Thanks given
    171
    Thanks received
    503
    Rep Power
    414
    Code:
    	private static int mix32(int v)
    	{
    		int a = v & 0xff;
    		int b = (v >>> 8) & 0xff;
    		int c = (v >>> 16) & 0xff;
    		int d = v >>> 24;
    		//AUTHOR: JOSEPH R. MELSHA
    		int A = a + b;
    		int B = b + c;
    		int C = c + d;
    		int D = d + a;
    		a += C;
    		b += D;
    		c += A;
    		d += B;
    		return (a << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff);
    	}
    Has this been written before?
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jan 2010
    Posts
    3,664
    Thanks given
    533
    Thanks received
    918
    Rep Power
    0
    What is this used for?
    Reply With Quote  
     

  3. #3  
    Registered Member Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,480
    Thanks given
    171
    Thanks received
    503
    Rep Power
    414
    Quote Originally Posted by Arsenic View Post
    What is this used for?
    cryptography
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Donator

    Netty's Avatar
    Join Date
    Jul 2011
    Posts
    176
    Thanks given
    189
    Thanks received
    62
    Rep Power
    115
    looks secure to me.



    Reply With Quote  
     

  6. #5  
    Renown Programmer and Respected Member
    Maxi's Avatar
    Join Date
    Jun 2008
    Posts
    3,197
    Thanks given
    281
    Thanks received
    1,095
    Rep Power
    1366
    Quote Originally Posted by Killer 99 View Post
    Code:
    	private static int mix32(int v)
    	{
    		int a = v & 0xff;
    		int b = (v >>> 8) & 0xff;
    		int c = (v >>> 16) & 0xff;
    		int d = v >>> 24;
    		//AUTHOR: JOSEPH R. MELSHA
    		int A = a + b;
    		int B = b + c;
    		int C = c + d;
    		int D = d + a;
    		a += C;
    		b += D;
    		c += A;
    		d += B;
    		return (a << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff);
    	}
    Has this been written before?
    To me it seems you can't reverse this as you're summing up the values of 3 bytes together into an integer value, most probably overflowing the first 8 bits into the rest of the bits, and after that you cut of 24 bits and keep the last 8 bits cutting away a maximum of 16 significant bits:

    Code:
    a = ((v & 0xff) + ((v >>> 16) & 0xff) + (v >>> 24)) & 0xff
    You loose bits so you can't say what's inside the 4 bytes that are created to construct the mixed 32 bit integer.
    Reply With Quote  
     

  7. #6  
    Chemist

    Advocatus's Avatar
    Join Date
    Dec 2009
    Posts
    2,622
    Thanks given
    201
    Thanks received
    813
    Rep Power
    1462
    You know the following about your method. Each byte is repeated exactly 3 times across the whole mixing process. Values are combined by simple addition. As a result, when reading you can do.

    Code:
            int value = (a + b + c + d) / 3;
    Which is equal to the sum of all the initial bytes in the encryption method

    Code:
            int first = value - a;
            int second = value - b;
            int third =  value - c; 
            int fourth = value - d;
    At this point, it should be relatively simple to get the individual initial bytes by subtracting the numbers, since the value quantity is composed of all 4 bytes whereas each of the read bytes is only 3 of them.

    Note: The naming is based around your convention of a, b, c,d. Ofc you will need to split up the encrypted number into bytes again. Additionally, with larger numbers there will be a loss of data. I cbf really at hypothesizing what that would be approximately.
    Quote Originally Posted by blakeman8192 View Post
    Quitting is the only true failure.
    Reply With Quote  
     

  8. #7  
    Registered Member Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,480
    Thanks given
    171
    Thanks received
    503
    Rep Power
    414
    the cool thing about this function is that it has no collisions.
    Reply With Quote  
     

  9. #8  
    ¯̿ ̿|̿ ̿ |̶ ̶ ̶ ̶| |̶͇̿ ̶͇̿ ͇̿ Haskelle

    Join Date
    Nov 2007
    Age
    29
    Posts
    1,227
    Thanks given
    329
    Thanks received
    517
    Rep Power
    1133
    Quote Originally Posted by Killer 99 View Post
    the cool thing about this function is that it has no collisions.
    How do you know this? . and hashing a 32 bit number to a 32 bit number. where every number maps to another number doesn't sound 'secure' to me.
    Monads are just Monoids in the category of Endofunctors. What is the problem?
    Costate Comonad Coalgebra is equivalent of Java's member variable update technology for haskell. Problem?
    Reply With Quote  
     

  10. #9  
    Registered Member
    Mister Maggot's Avatar
    Join Date
    Dec 2008
    Posts
    7,227
    Thanks given
    3,283
    Thanks received
    2,875
    Rep Power
    5000
    Quote Originally Posted by Cups View Post
    How do you know this? . and hashing a 32 bit number to a 32 bit number. where every number maps to another number doesn't sound 'secure' to me.
    Rainbow tables and simple bruteforce (like fucking 3 seconds) would be retardedly simple.
    Reply With Quote  
     

  11. #10  
    Registered Member Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,480
    Thanks given
    171
    Thanks received
    503
    Rep Power
    414
    Quote Originally Posted by Cups View Post
    How do you know this? . and hashing a 32 bit number to a 32 bit number. where every number maps to another number doesn't sound 'secure' to me.
    i plan on making this into a compression hash

    Quote Originally Posted by Mister Maggot View Post
    Rainbow tables and simple bruteforce (like fucking 3 seconds) would be retardedly simple.

    yes, but not if the block size is going to be 512 bits and the input size is going to be larger than that.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Reverse this
    By .fabian in forum Requests
    Replies: 2
    Last Post: 11-03-2010, 05:45 PM
  2. How would you reverse this bitshift?
    By Zee Best in forum Application Development
    Replies: 1
    Last Post: 09-29-2009, 05:35 PM
  3. reverse this
    By injectionsss in forum Help
    Replies: 2
    Last Post: 07-17-2009, 04:44 AM
  4. reverse this..
    By Clienthax in forum Help
    Replies: 17
    Last Post: 03-05-2009, 02:13 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •