mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
[multi]
- cleanup comments and remove Add from g2 since there is no Add precompile for G2
This commit is contained in:
parent
3c03b0cbbc
commit
177c7a1532
2 changed files with 15 additions and 20 deletions
|
|
@ -18,27 +18,27 @@ type G1 struct {
|
|||
inner bn254.G1Affine
|
||||
}
|
||||
|
||||
// Add adds `a` and `b` together storing the result in `g`
|
||||
// Add adds `a` and `b` together, storing the result in `g`
|
||||
func (g *G1) Add(a, b *G1) {
|
||||
g.inner.Add(&a.inner, &b.inner)
|
||||
}
|
||||
|
||||
// ScalarMult computes the scalar multiplication between `a` and
|
||||
// `scalar` storing the result in `g`
|
||||
// `scalar`, storing the result in `g`
|
||||
func (g *G1) ScalarMult(a *G1, scalar *big.Int) {
|
||||
g.inner.ScalarMultiplication(&a.inner, scalar)
|
||||
}
|
||||
|
||||
// Unmarshal deserializes `buf` into `g`
|
||||
//
|
||||
// Note: whether the serialization is of a compressed
|
||||
// or an uncompressed point, is encoding in the bytes.
|
||||
// Note: whether the deserialization is of a compressed
|
||||
// or an uncompressed point, is encoded in the bytes.
|
||||
//
|
||||
// For our purpose, the point will always be serialized as uncompressed
|
||||
// ie 64 bytes.
|
||||
// For our purpose, the point will always be serialized
|
||||
// as uncompressed, ie 64 bytes.
|
||||
//
|
||||
// This method checks whether the point is on the curve and
|
||||
// in the subgroup.
|
||||
// This method also checks whether the point is on the
|
||||
// curve and in the prime order subgroup.
|
||||
func (g *G1) Unmarshal(buf []byte) (int, error) {
|
||||
return g.inner.SetBytes(buf)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
//
|
||||
// Since this code is used for precompiles, using Jacobian
|
||||
// points are not beneficial because there are no intermediate
|
||||
// points.
|
||||
// points and G2 in particular is only used for the pairing input.
|
||||
//
|
||||
// Note: We also use this struct so that we can conform to the existing API
|
||||
// that the precompiles want.
|
||||
|
|
@ -16,21 +16,16 @@ type G2 struct {
|
|||
inner bn254.G2Affine
|
||||
}
|
||||
|
||||
// Add adds `a` and `b` together storing the result in `g`
|
||||
func (g *G2) Add(a, b *G2) {
|
||||
g.inner.Add(&a.inner, &b.inner)
|
||||
}
|
||||
|
||||
// Unmarshal deserializes `buf` into `g`
|
||||
//
|
||||
// Note: whether the serialization is of a compressed
|
||||
// or an uncompressed point, is encoding in the bytes.
|
||||
// Note: whether the deserialization is of a compressed
|
||||
// or an uncompressed point, is encoded in the bytes.
|
||||
//
|
||||
// For our purpose, the point will always be serialized as uncompressed
|
||||
// ie 128 bytes.
|
||||
// For our purpose, the point will always be serialized
|
||||
// as uncompressed, ie 128 bytes.
|
||||
//
|
||||
// This method checks whether the point is on the curve and
|
||||
// in the subgroup.
|
||||
// This method also checks whether the point is on the
|
||||
// curve and in the prime order subgroup.
|
||||
func (g *G2) Unmarshal(buf []byte) (int, error) {
|
||||
return g.inner.SetBytes(buf)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue