Thread: help solve this enigma, please

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    9

    help solve this enigma, please

    Hello fellows,

    i'm trying to put this code to work, but it's not easy to solve this..
    Can you guys help me out, please?

    Thank You in advance.

    Code:
    //<pre> XML 
    //Libraries
    #include <stdio.h> 
    #include <stdlib.h> 
    //Global variables
    typedef unsigned __int32 uint32_t; 
    typedef unsigned __int64 uint64_t; 
    //#define N(1<<25) 
    #define N 25 
    #define F(a,b){(a)^=(a);(a)^=(b);} 
    //int d[N]; 
    uint32_t d[N]; 
    //Main programm: show email
    int main(void) 
    { 
    //int h,i,j; 
    uint64_t h,i,j; 
    for(i=1;i<N;i++) 
    d[i] = d[i-1] * 69069 + 1; 
    for(i=0;i<N;i++) 
    for(j=1;j<N;j++) 
    if(d[j]=1<d[j-1]) 
    F(d[j-1],d[j]) 
    h=0; 
    for(i=0;i<N;i++) 
    h=h*13*d[i]; 
    h ^= 0x8678ADF24D4F64EFULL; 
    printf("Please, mail to %[email protected]\n",&h); 
    return 0; 
    } 
    //</pre>

  2. #2
    Registered User TheBigH's Avatar
    Join Date
    May 2010
    Location
    Melbourne, Australia
    Posts
    426
    What is it supposed to do, and what have you tried?
    Code:
    while(!asleep) {
       sheep++;
    }

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    One word... indentation.

    So what's it not doing?

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Double Header! ... hello TheBigH.

  5. #5
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    What i have to do, is resolve this enigma, to obtain the email, that if everything is good, it will print the email...

    i have tried this solution, but the result is the same...still cant decrypt the email.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdint.h>
    #include <string.h>
    
    #define N ( 1 << 25)
    #define F(a,b){(a)^=(a);(a)^=(b);}
    uint32_t d[N];
    
    int comp(const void *a, const void *b)
    {
            return *(uint32_t*) b - *(uint32_t*) a;
    }
    
    
    int main(void)
    {
       uint64_t h,i,j;
    
            memset(d, 0, N);
            for(i=1;i<N;i++)
            {
              d[i] = d[i-1] * 69069 + 1;
            }
    
        printf("sort...\n");
    
        qsort(d, N, sizeof(uint32_t), comp);
    
            /*for(i=0;i<N;i++)
            {
              for(j=1;j<N;j++)
              {
    
                 if(d[j]=1<d[j-1])
                 {
                   F(d[j-1],d[j])
                 }
              }
            }*/
          printf("random...\n");
    
          h = 0;
    
          for(i=0;i<N;i++)
          {
           h = h*13*d[i];
          }
    
          h ^= 0x8678ADF24D4F64EFULL;
    
          printf("Please, mail your to %[email protected]\n",&h);
    
          return 0;
    }

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Define ... "If everything is good"...

    You want answers you got to give us enough information to know what the heck you're talking about...

  7. #7
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    hmm....and where do you get your "email" from?
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  8. #8
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    This is a test that my University gave me, and the code is incomplete, so what i have to do is find out what is missing here to obtain the final correct email...
    When i said " if everything is good" i meant to say if the missing parts of the code were correctly inserted, the correct email will be revealed.

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by AndrewHunter View Post
    hmm....and where do you get your "email" from?
    I now have 2 more questions...

    1) How the heck many versions of this thing are floating around?
    2) Where is he getting the source code from?

  10. #10
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    don't know, they just gave me this to solve, and it's making me crazy...can't solve this...

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by falcon758 View Post
    This is a test that my University gave me, and the code is incomplete, so what i have to do is find out what is missing here to obtain the final correct email...
    When i said " if everything is good" i meant to say if the missing parts of the code where correctly inserted, the correct email will be revealed.
    Homework Policy

    We're not going to do your homework for you... especially if we are only going to get half answers...
    1) What part of that code was supplied to you?
    2) In the parts you've added, what isn't working as expected?
    3) How was the email encrypted in the first place?

  12. #12
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I don't know why you thought you could swap out qsort for those loops. Go look at what it does:
    Code:
    for(i=0;i<25;i++)
    {
        for(j=1;j<25;j++)
        {
            d[j] = 1;
            if( 1 < d[j - 1] )
            {
                d[j - 1] = 0;
                d[j - 1] = 1
             }
        }
    }
    I'm pretty sure that's not a qsort. But I'm open to being wrong on this.


    Quzah.
    Hope is the first step on the road to disappointment.

  13. #13
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by falcon758 View Post
    don't know, they just gave me this to solve, and it's making me crazy...can't solve this...
    So why don't you highlight the portions of the code you have inserted. This looks like encryption hw to me.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  14. #14
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by AndrewHunter View Post
    So why don't you highlight the portions of the code you have inserted. This looks like encryption hw to me.
    Problem is, you can't decrypt anything unless you know *exactly* how it is encrypted in the first place...

  15. #15
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    i don't want that you give me the answer to me, just need some tips to be guided in the correct direction.

    1) the part supplied was the first one that i posted.
    2) i still obtain the encrypted email, i can't understand what is missing, and why it's not working.
    3) Don't know the answer my friend, just know that this code can decrypt it, if i complete it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enigma execpvp
    By simpatico_qa in forum C Programming
    Replies: 10
    Last Post: 05-11-2009, 03:04 PM
  2. Win32 Battleship game enigma?
    By Finchie_88 in forum Windows Programming
    Replies: 7
    Last Post: 03-20-2005, 07:17 AM
  3. a new enigma
    By caroundw5h in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-17-2004, 07:14 PM
  4. Help About The ENIGMA Algoritm
    By JohnnyAtomic in forum C Programming
    Replies: 4
    Last Post: 02-22-2002, 10:05 AM
  5. Another do-while enigma..for me
    By bugeye in forum C Programming
    Replies: 9
    Last Post: 01-26-2002, 09:24 AM