<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # package elliptic `import "crypto/elliptic"` elliptic包實現了幾條覆蓋素數有限域的標準橢圓曲線。 ## Index * [type Curve](#Curve) * [func P224() Curve](#P224) * [func P256() Curve](#P256) * [func P384() Curve](#P384) * [func P521() Curve](#P521) * [type CurveParams](#CurveParams) * [func (curve \*CurveParams) Add(x1, y1, x2, y2 \*big.Int) (\*big.Int, \*big.Int)](#CurveParams.Add) * [func (curve \*CurveParams) Double(x1, y1 \*big.Int) (\*big.Int, \*big.Int)](#CurveParams.Double) * [func (curve \*CurveParams) IsOnCurve(x, y \*big.Int) bool](#CurveParams.IsOnCurve) * [func (curve \*CurveParams) Params() \*CurveParams](#CurveParams.Params) * [func (curve \*CurveParams) ScalarBaseMult(k []byte) (\*big.Int, \*big.Int)](#CurveParams.ScalarBaseMult) * [func (curve \*CurveParams) ScalarMult(Bx, By \*big.Int, k []byte) (\*big.Int, \*big.Int)](#CurveParams.ScalarMult) * [func GenerateKey(curve Curve, rand io.Reader) (priv []byte, x, y \*big.Int, err error)](#GenerateKey) * [func Marshal(curve Curve, x, y \*big.Int) []byte](#Marshal) * [func Unmarshal(curve Curve, data []byte) (x, y \*big.Int)](#Unmarshal) ## type [Curve](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L24 "View Source") ``` type Curve interface { // Params返回橢圓曲線的參數 Params() *CurveParams // IsOnCurve判斷一個點是否在橢圓曲線上 IsOnCurve(x, y *big.Int) bool // 返回點(x1,y1)和點(x2,y2)相加的結果 Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int) // 返回2*(x,y),即(x,y)+(x,y) Double(x1, y1 *big.Int) (x, y *big.Int) // k是一個大端在前格式的數字,返回k*(Bx,By) ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int) // k是一個大端在前格式的數字,返回k*G,G是本橢圓曲線的基點 ScalarBaseMult(k []byte) (x, y *big.Int) } ``` Curve代表一個短格式的Weierstrass橢圓曲線,其中a=-3。 Weierstrass橢圓曲線的格式:y\*\*2 = x\*\*3 + a\*x + b 參見[http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html](http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html) ### func [P224](https://github.com/golang/go/blob/master/src/crypto/elliptic/p224.go#L39 "View Source") ``` func P224() Curve ``` 返回一個實現了P-224的曲線。(參見FIPS 186-3, section D.2.2) ### func [P256](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L358 "View Source") ``` func P256() Curve ``` 返回一個實現了P-256的曲線。(參見FIPS 186-3, section D.2.3) ### func [P384](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L364 "View Source") ``` func P384() Curve ``` 返回一個實現了P-384的曲線。(參見FIPS 186-3, section D.2.4) ### func [P521](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L370 "View Source") ``` func P521() Curve ``` 返回一個實現了P-512的曲線。(參見FIPS 186-3, section D.2.5) ## type [CurveParams](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L42 "View Source") ``` type CurveParams struct { P *big.Int // 決定有限域的p的值(必須是素數) N *big.Int // 基點的階(必須是素數) B *big.Int // 曲線公式的常量(B!=2) Gx, Gy *big.Int // 基點的坐標 BitSize int // 決定有限域的p的字位數 } ``` CurveParams包含一個橢圓曲線的所有參數,也可提供一般的、非常數時間實現的橢圓曲線。 ### func (\*CurveParams) [Params](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L50 "View Source") ``` func (curve *CurveParams) Params() *CurveParams ``` ### func (\*CurveParams) [IsOnCurve](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L54 "View Source") ``` func (curve *CurveParams) IsOnCurve(x, y *big.Int) bool ``` ### func (\*CurveParams) [Add](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L101 "View Source") ``` func (curve *CurveParams) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) ``` ### func (\*CurveParams) [Double](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L185 "View Source") ``` func (curve *CurveParams) Double(x1, y1 *big.Int) (*big.Int, *big.Int) ``` ### func (\*CurveParams) [ScalarMult](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L250 "View Source") ``` func (curve *CurveParams) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) ``` ### func (\*CurveParams) [ScalarBaseMult](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L267 "View Source") ``` func (curve *CurveParams) ScalarBaseMult(k []byte) (*big.Int, *big.Int) ``` ## func [GenerateKey](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L275 "View Source") ``` func GenerateKey(curve Curve, rand io.Reader) (priv []byte, x, y *big.Int, err error) ``` GenerateKey返回一個公鑰/私鑰對。priv是私鑰,而(x,y)是公鑰。密鑰對是通過提供的隨機數讀取器來生成的,該io.Reader接口必須返回隨機數據。 ## func [Marshal](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L297 "View Source") ``` func Marshal(curve Curve, x, y *big.Int) []byte ``` Marshal將一個點編碼為ANSI X9.62指定的格式。 ## func [Unmarshal](https://github.com/golang/go/blob/master/src/crypto/elliptic/elliptic.go#L311 "View Source") ``` func Unmarshal(curve Curve, data []byte) (x, y *big.Int) ``` 將一個Marshal編碼后的點還原;如果出錯,x會被設為nil。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看