Advertisement
Guest User

Untitled

a guest
Aug 20th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. p = 2**256 - 2**32 - 2**9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
  2.  
  3.  
  4. a = 0x0000000000000000000000000000000000000000000000000000000000000000
  5.  
  6. b = 0x0000000000000000000000000000000000000000000000000000000000000007
  7.  
  8. F = GF(p)
  9.  
  10. eccurve = EllipticCurve(F,[a, b])
  11.  
  12. curve = eccurve
  13.  
  14. ord = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
  15.  
  16. Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
  17. Gy = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
  18. G = curve(Gx,Gy,1)
  19.  
  20.  
  21. #This is a setion with data about Q !!! Wea are not calculating Q and we need find a x and calculate Qz=x*G=Q. We are know Q,G but dont know x !!!
  22. Q = curve(0x8b05b0603abd75b0c57489e451f811e1afe54a8715045cdf4888333f3ebc6e8b,0x1d10f88145db40fb889e2ddce81bda7c27f5b615acd6179dbb30f4fe7f40fb39)
  23. print(Q)
  24.  
  25. R = Zmod(ord)
  26.  
  27. #end of section
  28. ##In this section calculated G2,y and Q = G2*y
  29.  
  30. x0 = R(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
  31. y = 1/x0
  32.  
  33.  
  34. G2 = ZZ( y ) *Q
  35.  
  36. Q2 = ZZ(x0) * G2
  37.  
  38.  
  39. ##End of section
  40.  
  41. #This section after x was find. Find a x and paste to this code:
  42.  
  43. #x = ....
  44.  
  45. #Qresult=ZZ (x) * G
  46. #print("Q==Qresult'", Q == Qresult)
  47.  
  48. #end of section
  49.  
  50. print("Q==Q2'", Q2 == Q)
  51. print("Q",Q)
  52. print("Q2",Q2)
  53.  
  54. print("y",y)
  55. print("G",G)
  56. print("G2",G2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement