INNER CODE UNIT · Go

SplitScalarFour

Consensys/gnark-crypto · ecc/utils.go:263

func SplitScalarFour(s *big.Int, l *Lattice4) [4]big.Int {
	var k1, k2, k3, k4 big.Int
	k1.Mul(s, &l.b1)
	k2.Mul(s, &l.b2)
	k3.Mul(s, &l.b3)
	k4.Mul(s, &l.b4)

	n := 2 * uint(((l.Det.BitLen()+32)>>6)<<6)
	k1.Rsh(&k1, n)
	k2.Rsh(&k2, n)
	k3.Rsh(&k3, n)
	k4.Rsh(&k4, n)

	res := getVector4(l, &k1, &k2, &k3, &k4)
	res[0].Sub(s, &res[0])
	res[1].Neg(&res[1])
	res[2].Neg(&res[2])
	res[3].Neg(&res[3])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…