File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
ecc/stark-curve/pedersen-hash Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -72,16 +72,14 @@ func Pedersen(a *fp.Element, b *fp.Element) *fp.Element {
7272}
7373
7474func processElement (a * fp.Element , p1 * starkcurve.G1Jac , p2 * starkcurve.G1Jac ) * starkcurve.G1Jac {
75- var bigInt big.Int
76- var aBytes [32 ]byte
77- a .BigInt (& bigInt ).FillBytes (aBytes [:])
75+ var lowPart , highPart big.Int
76+ aBytes := a .Bytes ()
7877
79- highPart := bigInt .SetUint64 (uint64 (aBytes [0 ])) // The top nibble (bits 249-252)
80- lowPart := aBytes [1 :] // Zero-out the top nibble (bits 249-252 )
78+ highPart .SetUint64 (uint64 (aBytes [0 ])) // The top nibble (bits 249-252)
79+ lowPart . SetBytes ( aBytes [1 :32 ] )
8180
82- m := new (starkcurve.G1Jac ).ScalarMultiplication (p2 , highPart )
81+ var sum starkcurve.G1Jac
82+ sum .JointScalarMultiplication (p1 , p2 , & lowPart , & highPart )
8383
84- var n starkcurve.G1Jac
85- n .ScalarMultiplication (p1 , bigInt .SetBytes (lowPart ))
86- return m .AddAssign (& n )
84+ return & sum
8785}
You can’t perform that action at this time.
0 commit comments