KrashKrash / Twist-Attack-Sub-Group-Attack

Twist and SubGroup attack on the ECDSA SECP256k1
7 stars 7 forks source link

coprime numbers #5

Open y2kbtc opened 3 months ago

y2kbtc commented 3 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration.

anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")
greenpp88 commented 3 months ago

hello

can you explain what's with this coprime pair? do we need to search coprime pair? what is the connection between these partial keys and coprime pair?

Thanks

y2kbtc commented 3 months ago

As you can read from creator this can be dangerous, he intentionally put some mistakes in the script itself and i agree with him so i can't give you specific details, i can give you a short explanation the pairs on the twist curves must be coprime in order to reconstruct the prv key, why ? Coprime Numbers: Two numbers are considered coprime (relatively prime) if they share no common divisors other than 1.

Why Coprime Matters (sometimes): When adding points on elliptic curves, the order of the resulting point is related to the orders of the points you added. In some specific scenarios, particularly when dealing with twists and point multiplication, it can be crucial that the orders of the points you're adding are coprime. This ensures a well-defined result and avoids certain complications.

greenpp88 commented 3 months ago

Hi.

Thanks for your explanation.

grothwen commented 2 months ago

Is it necessary to consider sextic twist isomorphism when transferring curves (secp256k1 --> twisted curves)? or can it be replaced by the concept of coprime?

KrashKrash commented 2 months ago

Is it necessary to consider sextic twist isomorphism when transferring curves (secp256k1 --> twisted curves)? or can it be replaced by the concept of coprime?

Hi Grothwen, no it is not necessary unless you want to have some kind of endomorphism linking back to the original public key. which would make this program moot. co prime is better. im updating the code in the next couple of days to make it more clearer for everyone who is using it. give me a few days.

Hurd8x commented 2 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration.

anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")

Hello

why you talk what curve with k=4 no coprime ?

Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

KrashKrash commented 2 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration. anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")

Hello

why you talk what curve with k=4 no coprime ?

Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

here is the thing, it actually depends on the public key you input. certain public key dont work on certain twisted curves. so you guys need to adjust and see whether certain curves has co primes, are zero discriminant and has a valid y public key. if this 3 bases are a go, then your twisted curve are valid and hence your partial private keys will be valid. so find your own twisted curve specific to your public key coordinates. usually, -7 works. 17 works too. i had gone so low as -30 to get a subgroup and as high as 30.

Hurd8x commented 2 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration. anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")

Hello why you talk what curve with k=4 no coprime ? Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

here is the thing, it actually depends on the public key you input. certain public key dont work on certain twisted curves. so you guys need to adjust and see whether certain curves has co primes, are zero discriminant and has a valid y public key. if this 3 bases are a go, then your twisted curve are valid and hence your partial private keys will be valid. so find your own twisted curve specific to your public key coordinates. usually, -7 works. 17 works too. i had gone so low as -30 to get a subgroup and as high as 30.

you need to verify not only y coordinate of point on twist, but point belong to twist curve or not - vryfy y and X, not only Y, yes ?

Hurd8x commented 2 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration. anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")

Hello why you talk what curve with k=4 no coprime ? Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

here is the thing, it actually depends on the public key you input. certain public key dont work on certain twisted curves. so you guys need to adjust and see whether certain curves has co primes, are zero discriminant and has a valid y public key. if this 3 bases are a go, then your twisted curve are valid and hence your partial private keys will be valid. so find your own twisted curve specific to your public key coordinates. usually, -7 works. 17 works too. i had gone so low as -30 to get a subgroup and as high as 30.

Bro, coprime is about curve, not depend from publick key, but, some point has point on a twist, some not.Combintion of twistS points different for different pubkeys, I Think(not verify yet, my phone to slow for normal tests).

Hurd8x commented 2 months ago

this is a twists from -7 to 7,they all coprime and non 0 discriminant:

Twist Curve -7: Weierstrass equation: y^2 = x^3 + 0 * x + -7 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834650495 Small Subgroups: [(3, 2), (13, 2), (3319, 1), (22639, 1)]

Twist Curve -6: Weierstrass equation: y^2 = x^3 + 0 * x + -6 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834656111 Small Subgroups: [(2, 2), (3, 1), (20412485227, 1)]

Twist Curve -5: Weierstrass equation: y^2 = x^3 + 0 * x + -5 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834660863 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

Twist Curve -4: Weierstrass equation: y^2 = x^3 + 0 * x + -4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(109903, 1), (12977017, 1), (383229727, 1)]

Twist Curve -3: Weierstrass equation: y^2 = x^3 + 0 * x + -3 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834667775 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

Twist Curve -2: Weierstrass equation: y^2 = x^3 + 0 * x + -2 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834669935 Small Subgroups: []

Twist Curve -1: Weierstrass equation: y^2 = x^3 + 0 * x + -1 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834671231 Small Subgroups: [(2, 2), (7, 2), (10903, 1), (5290657, 1), (10833080827, 1), (22921299619447, 1)]

Twist Curve 1: Weierstrass equation: y^2 = x^3 + 0 * x + 1 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834671231 Small Subgroups: [(2, 2), (3, 1), (20412485227, 1)]

Twist Curve 2: Weierstrass equation: y^2 = x^3 + 0 * x + 2 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834669935 Small Subgroups: [(3, 2), (13, 2), (3319, 1), (22639, 1)]

Twist Curve 3: Weierstrass equation: y^2 = x^3 + 0 * x + 3 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834667775 Small Subgroups: [(109903, 1), (12977017, 1), (383229727, 1)]

Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

Twist Curve 5: Weierstrass equation: y^2 = x^3 + 0 * x + 5 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834660863 Small Subgroups: [(109903, 1), (12977017, 1), (383229727, 1)]

Twist Curve 6: Weierstrass equation: y^2 = x^3 + 0 * x + 6 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834656111 Small Subgroups: [(2, 2), (7, 2), (10903, 1), (5290657, 1), (10833080827, 1), (22921299619447,

KrashKrash commented 2 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration. anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")

Hello why you talk what curve with k=4 no coprime ? Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

here is the thing, it actually depends on the public key you input. certain public key dont work on certain twisted curves. so you guys need to adjust and see whether certain curves has co primes, are zero discriminant and has a valid y public key. if this 3 bases are a go, then your twisted curve are valid and hence your partial private keys will be valid. so find your own twisted curve specific to your public key coordinates. usually, -7 works. 17 works too. i had gone so low as -30 to get a subgroup and as high as 30.

Bro, coprime is about curve, not depend from publick key, but, some point has point on a twist, some not.Combintion of twistS points different for different pubkeys, I Think(not verify yet, my phone to slow for normal tests).

yes i do know that the co primeness is about the numbers, not the public key. maybe i had not been clear in my explanation.

In order for this attack to work, you need co primeness, y coordinates being valid on the twisted curve and zero discriminant. if the orders are not co prime it wont work.

Hurd8x commented 2 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration. anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")

Hello why you talk what curve with k=4 no coprime ? Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

here is the thing, it actually depends on the public key you input. certain public key dont work on certain twisted curves. so you guys need to adjust and see whether certain curves has co primes, are zero discriminant and has a valid y public key. if this 3 bases are a go, then your twisted curve are valid and hence your partial private keys will be valid. so find your own twisted curve specific to your public key coordinates. usually, -7 works. 17 works too. i had gone so low as -30 to get a subgroup and as high as 30.

Bro, coprime is about curve, not depend from publick key, but, some point has point on a twist, some not.Combintion of twistS points different for different pubkeys, I Think(not verify yet, my phone to slow for normal tests).

yes i do know that the co primeness is about the numbers, not the public key. maybe i had not been clear in my explanation.

In order for this attack to work, you need co primeness, y coordinates being valid on the twisted curve and zero discriminant. if the orders are not co prime it wont work.

I was try but no success, I was send you pm at bitcointalk(cobras)...

Bro, can you provide one example with success finding key ?

agoora commented 2 months ago

Hello, I completely agree, please give us an example, in which the key is found successfully. Many thanks.

Hurd8x commented 2 months ago

Code for transform point from one curve o another wirh different k, but I dont understand how to transfer to different order:

from sage.rings.finite_rings.finite_field_constructor import FiniteField from sage.schemes.elliptic_curves.constructor import EllipticCurve

Параметры кривых

p1 = 3319

p2 = 3319 Fp1 = FiniteField(p1)

Fp2 = FiniteField(p2)

Коэффициенты для кривых

b1 = -5 b2 = 7

Создание кривых

curve1 = EllipticCurve(Fp1, [0, b1]) curve2 = EllipticCurve(Fp2, [0, b2])

Заданная точка на кривой 1 (GF(p), [0, -5])

x = Fp1(595) y = Fp1(1323)

Перебор всех возможных y' на кривой 2 (GF(p), [0, 7])

equivalent_point_found = False for y_prime in Fp2: if y_prime2 == x3 + b2*x + b2: print(f"Equivalent point on curve2: ({x}, {y_prime})") equivalent_point_found = True break

if not equivalent_point_found: print("No equivalent point found on curve2.")

Hurd8x commented 2 months ago

`

from sage.rings.finite_rings.finite_field_constructor import FiniteField from sage.schemes.elliptic_curves.constructor import EllipticCurve

Параметры кривых

p1 = 3319

p2 = 3319 Fp1 = FiniteField(p1)

Fp2 = FiniteField(p2)

Коэффициенты для кривых

b1 = -5 b2 = 7

Создание кривых

curve1 = EllipticCurve(Fp1, [0, b1]) curve2 = EllipticCurve(Fp2, [0, b2])

Заданная точка на кривой 1 (GF(p), [0, -5])

x = Fp1(595) y = Fp1(1323)

Перебор всех возможных y' на кривой 2 (GF(p), [0, 7])

equivalent_point_found = False for y_prime in Fp2: if y_prime2 == x3 + b2*x + b2: print(f"Equivalent point on curve2: ({x}, {y_prime})") equivalent_point_found = True break

if not equivalent_point_found: print("No equivalent point found on curve2.")

`

rdanalex commented 2 months ago

You did a nice job, but would you be so kind to show us some working example of this script? not for the entire private key but one that finds correctly the partial private key from another curve(twist, isomorphic, quadratic twist or whatever you want), meaning: partial_private_key == real_private_key % subgroup_order (otherwise crt wont work) thanks!

Hurd8x commented 2 months ago

You did a nice job, but would you be so kind to show us some working example of this script? not for the entire private key but one that finds correctly the partial private key from another curve(twist, isomorphic, quadratic twist or whatever you want), meaning: partial_private_key == real_private_key % subgroup_order (otherwise crt wont work) thanks!

I was try but unsuccessful. Krash not answered me to my pm. I dont know what to do. If you cant run original Krash twist scrypt need, replace "ElliptCurve" to "EllipticCurve"

I have no idea how to recover privkey, very unfortunately.

Hurd8x commented 2 months ago

You did a nice job, but would you be so kind to show us some working example of this script? not for the entire private key but one that finds correctly the partial private key from another curve(twist, isomorphic, quadratic twist or whatever you want), meaning: partial_private_key == real_private_key % subgroup_order (otherwise crt wont work) thanks!

And now i formation what is a new points what Krash scrypt make , "twist" what twist, is it a twist or not, with another base points I cant find partial privkey, how this is possible...

y2kbtc commented 2 months ago

You did a nice job, but would you be so kind to show us some working example of this script? not for the entire private key but one that finds correctly the partial private key from another curve(twist, isomorphic, quadratic twist or whatever you want), meaning: partial_private_key == real_private_key % subgroup_order (otherwise crt wont work) thanks!

And now i formation what is a new points what Krash scrypt make , "twist" what twist, is it a twist or not, with another base points I cant find partial privkey, how this is possible...

Work on fine tunning in twist curves start with own prv/pub key to get the ideea even one twist is enough if it is a match on a partial prv key ... From there is a trial/error thing.... If you find the perfect match on subgroup on twist ( you can modify the threshold value) on the script to give more data, some pub keys won't work also as a hint my p = which define the curve I have it different....

rdanalex commented 2 months ago

You did a nice job, but would you be so kind to show us some working example of this script? not for the entire private key but one that finds correctly the partial private key from another curve(twist, isomorphic, quadratic twist or whatever you want), meaning: partial_private_key == real_private_key % subgroup_order (otherwise crt wont work) thanks!

And now i formation what is a new points what Krash scrypt make , "twist" what twist, is it a twist or not, with another base points I cant find partial privkey, how this is possible...

Work on fine tunning in twist curves start with own prv/pub key to get the ideea even one twist is enough if it is a match on a partial prv key ... From there is a trial/error thing.... If you find the perfect match on subgroup on twist ( you can modify the threshold value) on the script to give more data, some pub keys won't work also as a hint my p = which define the curve I have it different....

did you find at least one correct partial private key on any curve and any order? and please exclude pure luck from your answer. Honestly, I doubt it. Partial key is guessed by bruteforcing the value of E.gens()[0] which can be any point that being multiplied by the curve order gives (0x0,0x0). You can check that E.gens()[] for secp256k1 curve doesnt even match the real G for bitcoin curve in sage. The only way a private key is found is in this case: hg = h E.gens()[0] hQ = hg private_key or in case you guess by luck a generator point for each curve that multiplied by the real partial private key gives the value of the twisted point. But anyway, happy hunting!

Hurd8x commented 2 months ago

You did a nice job, but would you be so kind to show us some working example of this script? not for the entire private key but one that finds correctly the partial private key from another curve(twist, isomorphic, quadratic twist or whatever you want), meaning: partial_private_key == real_private_key % subgroup_order (otherwise crt wont work) thanks!

And now i formation what is a new points what Krash scrypt make , "twist" what twist, is it a twist or not, with another base points I cant find partial privkey, how this is possible...

Work on fine tunning in twist curves start with own prv/pub key to get the ideea even one twist is enough if it is a match on a partial prv key ... From there is a trial/error thing.... If you find the perfect match on subgroup on twist ( you can modify the threshold value) on the script to give more data, some pub keys won't work also as a hint my p = which define the curve I have it different....

did you find at least one correct partial private key on any curve and any order? and please exclude pure luck from your answer. Honestly, I doubt it. Partial key is guessed by bruteforcing the value of E.gens()[0] which can be any point that being multiplied by the curve order gives (0x0,0x0). You can check that E.gens()[] for secp256k1 curve doesnt even match the real G for bitcoin curve in sage. The only way a private key is found is in this case: hg = h E.gens()[0] hQ = hg private_key or in case you guess by luck a generator point for each curve that multiplied by the real partial private key gives the value of the twisted point. But anyway, happy hunting!

Yes base points for the twist is a hg = h * E.gens()[0] E is a twist curve.

krashfire .sage scrypt partial pk, ( pk, order):

Partial private keys for Twist Curve 1 [(0, 3), (6, 13), (1502, 3319), (8892, 22639)]

greenpp88 commented 2 months ago

first of all very very nice script but i cannot acknowledge that is working especially on twist curve 4 is not producing the coprime pair maybe you can implement a mechanism to verify is the numbers are coprime -this is a small AI generated script for inspiration. anyway I appreciate your work

import random

def is_prime(num):
  """
  This function checks if a number is prime using a simple trial division.
  """
  if num <= 1:
    return False
  elif num <= 3:
    return True
  elif num % 2 == 0 or num % 3 == 0:
    return False
  i = 5
  while i * i <= num:
    if num % i == 0 or num % (i + 2) == 0:
      return False
    i += 6
  return True

def generate_coprime_numbers(num1, num2):
    """
    This function checks if two provided numbers are coprime.
    """
    if is_prime(num1) and is_prime(num2) and num1 != num2:
        return num1, num2
    else:
        print(f"Numbers {num1} and {num2} are not coprime.")
        return None  # Indicate no coprime numbers found

# Example usage with specific numbers
num1 = xxxxxxx  # Replace with your desired number
num2 = xxxxxx  # Replace with your desired number
coprime_pair = generate_coprime_numbers(num1, num2)

if coprime_pair:
    print(f"Coprime numbers: {coprime_pair[0]} and {coprime_pair[1]}")

print(f"Coprime numbers: {num1} and {num2}")

Hello why you talk what curve with k=4 no coprime ? Twist Curve 4: Weierstrass equation: y^2 = x^3 + 0 * x + 4 Discriminant: 115792089237316195423570985008687907853269984665640564039457584007908834664751 Small Subgroups: [(3, 1), (199, 1), (18979, 1)]

here is the thing, it actually depends on the public key you input. certain public key dont work on certain twisted curves. so you guys need to adjust and see whether certain curves has co primes, are zero discriminant and has a valid y public key. if this 3 bases are a go, then your twisted curve are valid and hence your partial private keys will be valid. so find your own twisted curve specific to your public key coordinates. usually, -7 works. 17 works too. i had gone so low as -30 to get a subgroup and as high as 30.

Bro, coprime is about curve, not depend from publick key, but, some point has point on a twist, some not.Combintion of twistS points different for different pubkeys, I Think(not verify yet, my phone to slow for normal tests).

yes i do know that the co primeness is about the numbers, not the public key. maybe i had not been clear in my explanation.

In order for this attack to work, you need co primeness, y coordinates being valid on the twisted curve and zero discriminant. if the orders are not co prime it wont work.

Krash, when will the update available?

agoora commented 2 months ago

Hello everyone, Waiting for an update from Krash, if you have done any update or if you have a working script, or if you want to share something about this topic. I invite you to a discussion on this private Telegram channel: https://t.me/+gJ9NGjNs8iRjZTU0 Thanks.

SergeyBasalaev commented 1 month ago

Unfortunately the results of the script have nothing in common secp256k1 curve.

agoora commented 1 month ago

hello, any update ?

dexizer37 commented 2 weeks ago

Okay example we found coprime numbers for order and partial key and after that how we can back to original private key?

dexizer37 commented 2 weeks ago

I tried with small curve but I cannot back to the original private key (in example private key is 12) Here the file ( https://pastebin.com/8NeqG9Mb ).

Hurd8x commented 2 weeks ago

Try take china reminder, chatGPT or other provide for you solutions code

You need many privkeys for same twist curves but with different curve order.Try use factors is secp256k1 , n -1 or n-2(I dont remember exact -1 or -2). And find provkeys for all factor include n = around 2*64 and after need provide finded provkeys to CRT

dexizer37 commented 2 weeks ago

Try take china reminder, chatGPT or other provide for you solutions code

You need many privkeys for same twist curves but with different curve order.Try use factors is secp256k1 , n -1 or n-2(I dont remember exact -1 or -2). And find provkeys for all factor include n = around 2*64 and after need provide finded provkeys to CRT

Ok I perfectly know CRT but I don't get same private key how can I combine it to get valid private key.

dexizer37 commented 2 weeks ago

Try take china reminder, chatGPT or other provide for you solutions code

You need many privkeys for same twist curves but with different curve order.Try use factors is secp256k1 , n -1 or n-2(I dont remember exact -1 or -2). And find provkeys for all factor include n = around 2*64 and after need provide finded provkeys to CRT

How I must combine it in right way?

Hurd8x commented 2 weeks ago

First take factors of secp56k1 N - 1, yiu can find in guthub twist attack on secp56k1 and find right factors

secon curve -7 is not isomorph to 7, take another k, I try 6, with yiur cide it is work

therd ask openGPT recover original private mey with chaina reminder theirem, provide chatGPT you cide and he is insert CRT function to your code

Hurd8x commented 2 weeks ago

?

Hurd8x commented 2 weeks ago

Then you multiply your subrop orders resukt mast be bigger the N of secp266k1

Hurd8x commented 2 weeks ago

This more information

https://github.com/Hurd8x/blog/blob/master/2020_05_26_secp256k1_twist_attacks/secp256k1_twist_attacks.md

dexizer37 commented 2 weeks ago

This more information

https://github.com/Hurd8x/blog/blob/master/2020_05_26_secp256k1_twist_attacks/secp256k1_twist_attacks.md

Ok thank you for informations but I know these informations for a very long time.

Hurd8x commented 2 weeks ago

This more information https://github.com/Hurd8x/blog/blob/master/2020_05_26_secp256k1_twist_attacks/secp256k1_twist_attacks.md

Ok thank you for informations but I know these informations for a very long time.

ok

not help you this info ? What not work ?