Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-02-2016, 07:36
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
Post Find the secret key for this function

Code:
bool check(uint64_t key)
{
    return key * key * key * key * key * key * key == 0x90de757572b51cd3;
}
It returns true for the the correct key, but what is it and how do you find it?
Reply With Quote
The Following User Gave Reputation+1 to dila For This Useful Post:
mr.exodia (06-02-2016)
  #2  
Old 06-02-2016, 13:30
Conquest Conquest is offline
Friend
 
Join Date: Jan 2013
Location: 0x484F4D45
Posts: 125
Rept. Given: 46
Rept. Rcvd 29 Times in 17 Posts
Thanks Given: 33
Thanks Rcvd at 60 Times in 29 Posts
Conquest Reputation: 29
find the 7th root of the value. Any mathematics solver program should be good enough
Reply With Quote
  #3  
Old 06-02-2016, 14:36
SmilingWolf SmilingWolf is offline
Family
 
Join Date: Dec 2014
Posts: 43
Rept. Given: 4
Rept. Rcvd 97 Times in 24 Posts
Thanks Given: 4
Thanks Rcvd at 149 Times in 30 Posts
SmilingWolf Reputation: 97
Quote:
Originally Posted by Conquest View Post
find the 7th root of the value. Any mathematics solver program should be good enough
Yeah... except that the 7th root of that value is not an integer while the input to the function is.
You have to find an x such that (x^7 & 0xFFFFFFFFFFFFFFFF) == 0x90de757572b51cd3
Reply With Quote
  #4  
Old 06-02-2016, 14:52
anon_c anon_c is offline
Friend
 
Join Date: Jan 2011
Posts: 27
Rept. Given: 25
Rept. Rcvd 8 Times in 3 Posts
Thanks Given: 12
Thanks Rcvd at 7 Times in 7 Posts
anon_c Reputation: 8
@Conquest
Not exactly. Bear in mind the Int64 precision.

Say you work in 16 bits
You want X^7 == 8680
Solve for the 7th root and you will get in decimal 4.44712��
But a valid solution would be for instance: 4A (74 dec) because the result of 4A ^ 7 is 8680 in 16bit

@Dila
I don��t see any other option than brute force

AC
Reply With Quote
  #5  
Old 06-02-2016, 16:41
Kerlingen Kerlingen is offline
VIP
 
Join Date: Feb 2011
Posts: 338
Rept. Given: 0
Rept. Rcvd 278 Times in 100 Posts
Thanks Given: 0
Thanks Rcvd at 358 Times in 110 Posts
Kerlingen Reputation: 200-299 Kerlingen Reputation: 200-299 Kerlingen Reputation: 200-299
E80E9AAC619831FB

And no, I didn't bruteforce 20.000 years, it's just simple math.

Just as a small hint:
If "x^7" is supposed to end on the digit "3", could "x" ever be a multiple of "2"?
Answer: No.
You've reduced the number of possible values for "x" by 50%.

Last edited by Kerlingen; 06-02-2016 at 19:40. Reason: Of course it's 20k (=20.000) years. 20 would be far too low. ;)
Reply With Quote
The Following User Says Thank You to Kerlingen For This Useful Post:
dila (06-03-2016)
  #6  
Old 06-02-2016, 21:13
Syoma Syoma is offline
reverse engineer
 
Join Date: May 2009
Posts: 338
Rept. Given: 35
Rept. Rcvd 77 Times in 50 Posts
Thanks Given: 15
Thanks Rcvd at 78 Times in 51 Posts
Syoma Reputation: 77
It is the standard x^y mod n = c like RSA uses but with bad modulo N.
Reply With Quote
  #7  
Old 06-02-2016, 23:14
UniSoft's Avatar
UniSoft UniSoft is offline
Family
 
Join Date: May 2010
Location: Shenzhen, China
Posts: 124
Rept. Given: 24
Rept. Rcvd 259 Times in 42 Posts
Thanks Given: 25
Thanks Rcvd at 406 Times in 73 Posts
UniSoft Reputation: 200-299 UniSoft Reputation: 200-299 UniSoft Reputation: 200-299
Code:
#define EXP7(x)  ((x) * (x) * (x) * (x) * (x) * (x) * (x))

uint64_t res = 0x90de757572b51cd3ULL;
uint64_t key = 0;
uint64_t mask = 1ULL;

while (mask)
{
    if ((EXP7(key) ^ res) & mask)
    {
        key |= mask;
        if ((EXP7(key) ^ res) & mask)
            break;
    }
    mask <<= 1;
}

if (mask)
    printf("not found");
else
    printf("found: 0x%llX", key);

Last edited by UniSoft; 06-04-2016 at 00:11.
Reply With Quote
The Following 4 Users Say Thank You to UniSoft For This Useful Post:
an0rma1 (06-03-2016), dila (06-03-2016), |roe (06-08-2016)
  #8  
Old 06-02-2016, 23:14
Kerlingen Kerlingen is offline
VIP
 
Join Date: Feb 2011
Posts: 338
Rept. Given: 0
Rept. Rcvd 278 Times in 100 Posts
Thanks Given: 0
Thanks Rcvd at 358 Times in 110 Posts
Kerlingen Reputation: 200-299 Kerlingen Reputation: 200-299 Kerlingen Reputation: 200-299
RSA is x^y with known x and unknown y.
This is x^y with unknown x and known y.
Two completely different things.
Reply With Quote
  #9  
Old 06-02-2016, 23:38
niculaita's Avatar
niculaita niculaita is offline
Family
 
Join Date: Jun 2011
Location: here
Posts: 1,475
Rept. Given: 1,009
Rept. Rcvd 95 Times in 65 Posts
Thanks Given: 5,429
Thanks Rcvd at 508 Times in 359 Posts
niculaita Reputation: 95
try this 0xFFFFFFFFFFFFFE0B or this 0xFFFFFFFFFFFFFE0C

Last edited by niculaita; 06-02-2016 at 23:43. Reason: integer
Reply With Quote
  #10  
Old 06-03-2016, 00:21
anon_c anon_c is offline
Friend
 
Join Date: Jan 2011
Posts: 27
Rept. Given: 25
Rept. Rcvd 8 Times in 3 Posts
Thanks Given: 12
Thanks Rcvd at 7 Times in 7 Posts
anon_c Reputation: 8
@Kerlingen
��just simple math��
What is the mathematical solution then? (I know it is not a difficult key to find��)

I believe everybody knows you don��t have to try all numbers! Indeed, simple math can be used to avoid nonsense bases. But I am curious to know your definition of brute force. Do you really believe trying all possible solution is the only definition? Dictionary attack over a WPA key for instance, is still a kind of Brute-force attack��

AC
Reply With Quote
  #11  
Old 06-03-2016, 03:35
Syoma Syoma is offline
reverse engineer
 
Join Date: May 2009
Posts: 338
Rept. Given: 35
Rept. Rcvd 77 Times in 50 Posts
Thanks Given: 15
Thanks Rcvd at 78 Times in 51 Posts
Syoma Reputation: 77
Quote:
Originally Posted by Kerlingen View Post
RSA is x^y with known x and unknown y.
This is x^y with unknown x and known y.
Two completely different things.
RSA powmod primitive is
c = m^e mod N, where c is ciphertext, m - message, e - public exponent, N - modulus
m = c^d mod N, where d is private exponent

our case is
0x90de757572b51cd3 = key^7 mod (max_uint64+1)

Last edited by Syoma; 06-03-2016 at 03:36. Reason: wrong summary
Reply With Quote
The Following 3 Users Say Thank You to Syoma For This Useful Post:
dila (06-03-2016), niculaita (06-03-2016)
  #12  
Old 06-03-2016, 12:15
UniSoft's Avatar
UniSoft UniSoft is offline
Family
 
Join Date: May 2010
Location: Shenzhen, China
Posts: 124
Rept. Given: 24
Rept. Rcvd 259 Times in 42 Posts
Thanks Given: 25
Thanks Rcvd at 406 Times in 73 Posts
UniSoft Reputation: 200-299 UniSoft Reputation: 200-299 UniSoft Reputation: 200-299
Quote:
Originally Posted by Syoma View Post
RSA powmod primitive is
c = m^e mod N, where c is ciphertext, m - message, e - public exponent, N - modulus
m = c^d mod N, where d is private exponent

our case is
0x90de757572b51cd3 = key^7 mod (max_uint64+1)
This is not the RSA !!!
In RSA N = p * q, where p and q are prime numbers!!!
max_uint64+1 = 0x10000000000000000 is not the product of two prime numbers, therefore the equation m = (m^e mod N)^d mod N will not work (mainly because of the large number of collisions).

Last edited by UniSoft; 06-03-2016 at 12:22.
Reply With Quote
  #13  
Old 06-03-2016, 16:42
Syoma Syoma is offline
reverse engineer
 
Join Date: May 2009
Posts: 338
Rept. Given: 35
Rept. Rcvd 77 Times in 50 Posts
Thanks Given: 15
Thanks Rcvd at 78 Times in 51 Posts
Syoma Reputation: 77
Quote:
Originally Posted by UniSoft View Post
This is not the RSA !!!
Did you ever read the topic? I wrote
It is the standard x^y mod n = c like RSA uses but with bad modulo N.
I did not write it is RSA. My suggestion was there may be simple math solution in number theory.

Just reviewed most popular directions. Do not see any simple solution.
x^7 = 3*3*31*4129*1499933*6041353 mod 2^64

Last edited by Syoma; 06-03-2016 at 16:54. Reason: Brutforce only?
Reply With Quote
The Following User Says Thank You to Syoma For This Useful Post:
dila (06-05-2016)
  #14  
Old 06-03-2016, 17:29
DARKER DARKER is offline
VIP
 
Join Date: Jul 2004
Location: Somewhere Over the Rainbow
Posts: 541
Rept. Given: 16
Rept. Rcvd 123 Times in 54 Posts
Thanks Given: 21
Thanks Rcvd at 1,038 Times in 262 Posts
DARKER Reputation: 100-199 DARKER Reputation: 100-199
0x90de757572b51cd3 = 10438910133587483859

10419912285387762041 = 521 ^7
10438910133587483859 = ~521,136 ^7 <- this is your number
10560719825892021888 = 522 ^7

but your key is uint64, so this is not possible because ~521,136 is not integer

PS: Other solution can be some another integer, it's case when you strip result to uint64 (last bytes of result are 0x90de757572b51cd3 - it's just end of some big number)

Last edited by DARKER; 06-22-2016 at 00:04.
Reply With Quote
  #15  
Old 06-05-2016, 17:58
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
In textbook RSA, you compute phi(n) from (p-1)(q-1), but that formula does not work if the modulus contains repeated prime factors. Here we have n = 2^64, so there are repeated 2's.

The requirement for modular exponentiation to be reversible is that gcd(e, phi(n)) = 1. If that turns out to be true, then a private exponent exists, which can "decrypt" the magic constant into the value of key.

@UniSoft: How does your solving code work??
Reply With Quote
Reply


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
GMP function Git General Discussion 4 06-16-2011 21:33
FUNCTION CHUNKs Git General Discussion 4 09-07-2005 19:35
C++ Help (Hooking a function) Peter[Pan] General Discussion 8 08-31-2004 20:37


All times are GMT +8. The time now is 06:36.


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