Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

`OpenSSL::PKey::EC::Point` should be able to get and set affine coordinates

未關閉
#433 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@rickmark 已經在處理了。

開始於 2021年4月4日。

  • #435 來自 @rickmark —— 未關閉

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
c, ruby
領域
cryptography

研究方向

未指定檔案或測試。先檢視現有的 OpenSSL::PKey::EC::Point API,以及 issue 中的壓縮點和未壓縮點範例。與維護者釐清提議的建構函式和座標存取設計,然後定義測試,顯示仿射座標擷取和點建構能如預期運作。

由索引模型根據 Issue 內容生成。

描述

It is possible using a little magic to create a point with a raw x and y:

   def self.from_compressed_point(group, x, is_even)
      x_value = x.to_s(2).rjust(32, "\x00")
      prefix = is_even ? "\x02" : "\x03"

      encoded = OpenSSL::BN.new [ prefix, x_value ].join, 2
      OpenSSL::PKey::EC::Point.new(group, encoded)
    end

One can similarly use some magic to get uncompressed points and turn them into two OpenSSL::BN instances

It would be better if we supported this without using compressed point form magic, like so (RBS signature with hypothetical overload):

class OpenSSL::PKey::EC::Point
  # Since the OpenSSL operation returns both
  def affine_coordinates -> [ OpenSSL::BN, OpenSSL::BN ]
  
  # Convenance methods for above
  attr_reader :x, :y -> OpenSSL::BN

  #  Choice 1 - Using Bool for Y
  def initialize : (group: OpenSSL::PKey::EC::Group, x: OpenSSL::BN, even: Boolean) -> OpenSSL::PKey::EC::Point

  # Choice 2 - Using a symbol for Y
  def initialize : (group: OpenSSL::PKey::EC::Group, x: OpenSSL::BN, y:[ :even, :odd ]) -> OpenSSL::PKey::EC::Point

  # Using X and Y directly
  def initialize : (group: OpenSSL::PKey::EC::Group, x: OpenSSL::BN, y: OpenSSL::BN) -> OpenSSL::PKey::EC::Point
end

I've intentionally omitted mutating the X and Y of a point after creation. Because all of these have a different aridity they will not conflict. Similarly adding Jacobian would create an aridity == 4.

The big question is for choice 1 or 2 when creating an X and which Y value.

主要語言
C
星號
276
分支
203
平均合併
1 天 7 小時
30 天內合併 PR
9

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ruby/openssl 的其他 Issue

查看 ruby/openssl 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。