Post
Topic
Board Development & Technical Discussion
Merits 8 from 4 users
Topic OP
Even or Odd Point
by
AlexanderCurl
on 14/11/2022, 11:25:36 UTC
⭐ Merited by hugeblack (4) ,vapourminer (2) ,odolvlobo (1) ,ETFbitcoin (1)
This method cannot help break secp256k1 security but nevertheless answers some questions.
There is a way to determine whether point is even or odd. Based on the math of first grade of school. It goes like this:
8=7+1
    6+2
    5+3
    4+4
(4+4) 4 <-> 4 condition: this point is even
9=8+1
  7+2
  6+3
  5+4
  4+5
(5+4)(4+5) 5 <-> 4  4<->5  condition: this point is odd

from ice_secp256k1 import *

curve_G = scalar_multiplication(1) # secp256k1 default generator point has scalar 1
Q = scalar_multiplication(4) #point to check
#Q = bytes.fromhex('0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c 4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8')
if Q == curve_G:
    raise ValueError('secp256k1 default generator point is odd (has scalar 1)')
A = point_subtraction(Q, curve_G)
B = curve_G
prev_A = prev_B = [0, 0]
while True:
    if A == B:
        print(f'Point is even (has Q=k(even scalar)*G)')
        break
    if A == prev_B and B == prev_A:
        print(f'Point is odd (has Q=k(odd scalar)*G')
        break
    prev_A = A
    prev_B = B
    A = point_subtraction(A, curve_G)
    B = point_addition(B, curve_G)

secp256k1 library from: https://github.com/iceland2k14/secp256k1