|
![](/i/fill.gif) |
Le 01/07/2014 14:23, Lars Rohwedder a écrit :
> 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;
> }
>
Which value of Secret2 would allow the * (without overloading) to
reverse the value with a value of Inverse_of_secret2.
If * is not overloaded for uint64_t, I see only Secret2 = 1 as valid if
the original code uses the whole 64 bits range.
Therefore either the encrypt/decrypt is a simple xor of a single 64 bits
(you won't get Secret1 and Secret3, but (Secret1|Secret3)), or the * is
overloaded and we need to known more about that operation.
--
Just because nobody complains does not mean all parachutes are perfect.
Post a reply to this message
|
![](/i/fill.gif) |