Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 01-17-2018, 02:28
dila dila is offline
Friend
 
Join Date: Jan 2010
Posts: 60
Rept. Given: 12
Rept. Rcvd 32 Times in 14 Posts
Thanks Given: 35
Thanks Rcvd at 74 Times in 20 Posts
dila Reputation: 32
Posting the code, since you expressed interest in it. Here we have the "encoder" which encodes a 6-bit integer (between 1 and 63) into the full serial. Note that we skip i=0 (and start at i=1) because the all-zero key is rejected by the routine, even though it is technically valid. There are no other valid keys.

I will spend some time thinking of a new challenge that is not so easy for UniSoft to solve next time

Code:
uint64_t generate(uint64_t x) {
  uint64_t y = 0;
  for (size_t i = 0; i < 64; ++i) {
    uint64_t u = x & i;
    uint64_t k = 0;
    for (size_t j = 0; j < 6; ++j) {
      k ^= (u >> j) & 1;
    }
    y |= k << i;
  }
  return y;
}

void print_keys() {
  for (size_t i = 1; i < 64; ++i) {
    uint64_t key = generate(i);
    if (check(key)) {
      std::cout << std::hex << key << std::endl;
    } else {
      std::cout << std::hex << key << " (BAD)" << std::endl;
    }
  }
}
Reply With Quote
The Following User Says Thank You to dila For This Useful Post:
tonyweb (01-18-2018)
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XP Startup - Must be simple because I can't solve it! hobferret General Discussion 13 07-09-2005 07:44


All times are GMT +8. The time now is 01:10.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )