POV-Ray : Newsgroups : povray.off-topic : How to break a simple "encryption"? : Re: How to break a simple "encryption"? Server Time
28 Jul 2024 10:23:55 EDT (-0400)
  Re: How to break a simple "encryption"?  
From: scott
Date: 22 Jul 2014 11:10:42
Message: <53ce7ef2$1@news.povray.org>
> I've seen a simple encryption like this:
>
> uint64_t poor_encrypt(uint64_t x)
> {
>      x = x ^ SECRET1;
>      x = x * SECRET2;
>      x = x ^ SECRET3;
>      return x;
> }
>
> the decryption is just the reverse:
>
> uint64_t poor_decrypt(uint64_t x)
> {
>      x = x ^ SECRET3;
>      x = x * INVERSE_OF_SECRET2;
>      x = x ^ SECRET1;
>      return x;
> }
>
>
> How many "x, encrypt(x)" pairs are necessary to reveal the 3 secret
> constants? I think, 3 pairs should be enough, but am I right?

I think it depends what you mean by "reveal". If you mean, can you 
"solve" the equations to find SECRET1-3, in the same way you would a 
mathematical equation, then it might not be possible without some 
element of brute-force. For example how do you solve (x*5)^(x*10)=49 
(where * and ^ are 8-bit CPU integer multiply and xor)?

The other question is, given the 3 pairs, is there a unique set of 
SECRET1-3, or could a different set allow the same pairs?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.