jvdsn / crypto-attacks

Python implementations of cryptographic attacks and utilities.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Frey ruck attack test

shemon11 opened this issue · comments

Hi, I need your help.
Please, can you say me how i can to get my own numbers in test example?
How I can generate or calculate P, R and l points?
Is it possible?

For example, we have a function:
def test_frey_ruck_attack(self):
p = 23305425500899
a = 13079575536215
b = 951241857177
l = 709658
E = EllipticCurve(GF(p), [a, b])
P = E(17662927853004, 1766549410280)
R = E(2072411881257, 5560421985272)
l_ = frey_ruck_attack.attack(P, R)
self.assertIsInstance(l_, int)
self.assertEqual(l, l_)

But I don't understand what is:
l = 709658
P = E(17662927853004, 1766549410280)
R = E(2072411881257, 5560421985272)
How we got that numbers?

I think that these numbers are Px, Py, Rx, Ry, l

What is P in this example, is this a public key if we talk about Bitcoin or base point?

Gx=79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
Gy=483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

And what is l, private key, nonce or other parameter?

The documentation answers your questions: https://github.com/jvdsn/crypto-attacks/blob/master/attacks/ecc/frey_ruck_attack.py#L16

    """
    Solves the discrete logarithm problem using the Frey-Ruck attack.
    More information: Harasawa R. et al., "Comparing the MOV and FR Reductions in Elliptic Curve Cryptography" (Section 3)
    :param P: the base point
    :param R: the point multiplication result
    :param max_k: the maximum value of embedding degree to try (default: 6)
    :param max_tries: the maximum amount of times to try to find l (default: 10)
    :return: l such that l * P == R, or None if l was not found
    """

I don't know what you're trying to do, but the Bitcoin curve is obviously not vulnerable to Frey-Ruck reduction.