Nintendo Sponsored Challenge

AceInfinity

Emeritus, Contributor
Joined
Feb 21, 2012
Posts
1,728
Location
Canada
There is a challenge on a coding website sponsored by Nintendo. The idea is to reverse the encoding process specified by the below code:
Code:
[NO-PARSE]
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
   int size;

   cin >> size;

   unsigned int *a = new unsigned int[size / 16]; // <- input tab to encrypt
   unsigned int *b = new unsigned int[size / 16]; // <- output tab

   for (int i = 0; i < size / 16; i++)     // Read size / 16 integers to a
   {
      cin >> hex >> a[i];
   }

   for (int i = 0; i < size / 16; i++)     // Write size / 16 zeros to b
   {
      b[i] = 0;
   }

   for (int i = 0; i < size; i++)
      for (int j = 0; j < size; j++)
      {
         b[(i + j) / 32] ^= ((a[i / 32] >> (i % 32)) &
                             (a[j / 32 + size / 32] >> (j % 32)) & 1) << ((i + j) % 32);    // Magic centaurian operation
      }

   for (int i = 0; i < size / 16; i++)
   {
      if (i > 0)
      {
         cout << ' ';
      }
      cout << setfill('0') << setw(8) << hex << b[i];       // print result
   }
   cout << endl;

   delete [] a;
   delete [] b;

   /*
      Good luck humans
   */

   return 0;
}[/NO-PARSE]

There is also some pseudo code for this encoding process on the website, but it's very difficult. For those of you brave enough to give it a shot: https://www.codingame.com

(In the "Games" section down near the bottom the Nintendo challenge description can be found)

Good luck! :thumbsup2:
 
This actually looks awesome! Thanks so much for linking this. I'll definitely give it a go. I love cryptography and this is essentially that. Challenge accepted ;)
 
I figured out that the problem is most likely related to algebra in this case with solving polynomials. I figured out how to reverse the process but determining whether to XOR my value or 0 is another problem. That's about as high level as it gets by the description of the pseudo-code and source code though. I don't want to give away any more of my information, but I have not solved it yet after many (many) hours. I sat at this for nearly 6 hours straight looking at patterns and crunching numbers to get a small bit further.
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top