INNER CODE UNIT · Go

WnafDecomposition

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

func WnafDecomposition(a *big.Int, window uint, result []int8) int {
	if window < 2 || window > 8 {
		return 0
	}
	if a.Sign() == 0 {
		return 0
	}

	var aCopy, mask, mod, tmp big.Int
	aCopy.Set(a)
	mask.SetUint64((1 << window) - 1)

	length := 0
	for aCopy.Sign() != 0 {
		if aCopy.Bit(0) == 1 {
			mod.And(&aCopy, &mask)
			u := mod.Int64()
			if u > (1 << (window - 1)) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…