Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ECDSA public key recover from message, signature and recovery info #347

Merged
merged 11 commits into from
Mar 3, 2023
10 changes: 8 additions & 2 deletions ecc/bls12-377/bls12-377.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import (
// ID bls377 ID
const ID = ecc.BLS12_377

// bCurveCoeff b coeff of the curve Y²=X³+b
// aCurveCoeff is the a coefficients of the curve Y²=X³+ax+b
var aCurveCoeff fp.Element
var bCurveCoeff fp.Element

// twist
Expand Down Expand Up @@ -97,7 +98,7 @@ type E6 = fptower.E6
type E12 = fptower.E12

func init() {

aCurveCoeff.SetUint64(0)
bCurveCoeff.SetUint64(1)
// D-twist
twist.A1.SetUint64(1)
Expand Down Expand Up @@ -148,3 +149,8 @@ func Generators() (g1Jac G1Jac, g2Jac G2Jac, g1Aff G1Affine, g2Aff G2Affine) {
g2Jac = g2Gen
return
}

// CurveCoefficients returns the a, b coefficients of the curve equation.
func CurveCoefficients() (a, b fp.Element) {
yelhousni marked this conversation as resolved.
Show resolved Hide resolved
return aCurveCoeff, bCurveCoeff
}
4 changes: 1 addition & 3 deletions ecc/bls12-377/ecdsa/ecdsa.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions ecc/bls12-378/bls12-378.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import (
// ID bls378 ID
const ID = ecc.BLS12_378

// bCurveCoeff b coeff of the curve Y²=X³+b
// aCurveCoeff is the a coefficients of the curve Y²=X³+ax+b
var aCurveCoeff fp.Element
var bCurveCoeff fp.Element

// bTwistCurveCoeff b coeff of the twist (defined over 𝔽p²) curve
Expand Down Expand Up @@ -94,7 +95,7 @@ type E6 = fptower.E6
type E12 = fptower.E12

func init() {

aCurveCoeff.SetUint64(0)
bCurveCoeff.SetUint64(1)
bTwistCurveCoeff.A1.SetUint64(1) // M-twist

Expand Down Expand Up @@ -145,3 +146,8 @@ func Generators() (g1Jac G1Jac, g2Jac G2Jac, g1Aff G1Affine, g2Aff G2Affine) {
g2Jac = g2Gen
return
}

// CurveCoefficients returns the a, b coefficients of the curve equation.
func CurveCoefficients() (a, b fp.Element) {
return aCurveCoeff, bCurveCoeff
}
4 changes: 1 addition & 3 deletions ecc/bls12-378/ecdsa/ecdsa.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions ecc/bls12-381/bls12-381.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import (
// ID bls381 ID
const ID = ecc.BLS12_381

// bCurveCoeff b coeff of the curve Y²=X³+b
// aCurveCoeff is the a coefficients of the curve Y²=X³+ax+b
var aCurveCoeff fp.Element
var bCurveCoeff fp.Element

// twist
Expand Down Expand Up @@ -86,7 +87,7 @@ var endo struct {
var xGen big.Int

func init() {

aCurveCoeff.SetUint64(0)
bCurveCoeff.SetUint64(4)
// M-twist
twist.A0.SetUint64(1)
Expand Down Expand Up @@ -140,3 +141,8 @@ func Generators() (g1Jac G1Jac, g2Jac G2Jac, g1Aff G1Affine, g2Aff G2Affine) {
g2Jac = g2Gen
return
}

// CurveCoefficients returns the a, b coefficients of the curve equation.
func CurveCoefficients() (a, b fp.Element) {
return aCurveCoeff, bCurveCoeff
}
4 changes: 1 addition & 3 deletions ecc/bls12-381/ecdsa/ecdsa.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions ecc/bls24-315/bls24-315.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import (
// ID bls315 ID
const ID = ecc.BLS24_315

// bCurveCoeff b coeff of the curve Y²=X³+b
// aCurveCoeff is the a coefficients of the curve Y²=X³+ax+b
var aCurveCoeff fp.Element
var bCurveCoeff fp.Element

// twist
Expand Down Expand Up @@ -101,7 +102,7 @@ type E12 = fptower.E12
type E24 = fptower.E24

func init() {

aCurveCoeff.SetUint64(0)
bCurveCoeff.SetUint64(1)
// D-twist
twist.B1.SetOne()
Expand Down Expand Up @@ -161,3 +162,8 @@ func Generators() (g1Jac G1Jac, g2Jac G2Jac, g1Aff G1Affine, g2Aff G2Affine) {
g2Jac = g2Gen
return
}

// CurveCoefficients returns the a, b coefficients of the curve equation.
func CurveCoefficients() (a, b fp.Element) {
return aCurveCoeff, bCurveCoeff
}
4 changes: 1 addition & 3 deletions ecc/bls24-315/ecdsa/ecdsa.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions ecc/bls24-317/bls24-317.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import (
// ID bls317 ID
const ID = ecc.BLS24_317

// bCurveCoeff b coeff of the curve Y²=X³+b
// aCurveCoeff is the a coefficients of the curve Y²=X³+ax+b
var aCurveCoeff fp.Element
var bCurveCoeff fp.Element

// twist
Expand Down Expand Up @@ -87,7 +88,7 @@ var endo struct {
var xGen big.Int

func init() {

aCurveCoeff.SetUint64(0)
bCurveCoeff.SetUint64(4)
// M-twist
twist.B1.SetOne()
Expand Down Expand Up @@ -149,3 +150,8 @@ func Generators() (g1Jac G1Jac, g2Jac G2Jac, g1Aff G1Affine, g2Aff G2Affine) {
g2Jac = g2Gen
return
}

// CurveCoefficients returns the a, b coefficients of the curve equation.
func CurveCoefficients() (a, b fp.Element) {
return aCurveCoeff, bCurveCoeff
}
4 changes: 1 addition & 3 deletions ecc/bls24-317/ecdsa/ecdsa.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions ecc/bn254/bn254.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ import (
// ID bn254 ID
const ID = ecc.BN254

// bCurveCoeff b coeff of the curve Y²=X³+b
// aCurveCoeff is the a coefficients of the curve Y²=X³+ax+b
var aCurveCoeff fp.Element
var bCurveCoeff fp.Element

// twist
Expand Down Expand Up @@ -100,7 +101,7 @@ var endo struct {
var xGen big.Int

func init() {

aCurveCoeff.SetUint64(0)
bCurveCoeff.SetUint64(3)
// D-twist
twist.A0.SetUint64(9)
Expand Down Expand Up @@ -154,3 +155,8 @@ func Generators() (g1Jac G1Jac, g2Jac G2Jac, g1Aff G1Affine, g2Aff G2Affine) {
g2Jac = g2Gen
return
}

// CurveCoefficients returns the a, b coefficients of the curve equation.
func CurveCoefficients() (a, b fp.Element) {
return aCurveCoeff, bCurveCoeff
}
Loading