func (t *prefixTree) newChildNode(parent *prefixNode, childIndex int) *prefixNode { n := &prefixNode{prefixTree: t, Leaf: true} var key *cf.Bitstring if parent != nil { parentKey := parent.Key() key = cf.NewBitstring(parentKey.BitLen() + t.BitQuantum) key.SetBytes(parentKey.Bytes()) for j := 0; j < parent.BitQuantum; j++ { if (1<<uint(j))&childIndex == 0 { key.Clear(parentKey.BitLen() + j) } else { key.Set(parentKey.BitLen() + j) } } } else { key = cf.NewBitstring(0) } n.NodeKey = mustEncodeBitstring(key) svalues := make([]*cf.Zp, t.NumSamples()) for i := 0; i < len(svalues); i++ { svalues[i] = cf.Zi(cf.P_SKS, 1) } n.NodeSValues = mustEncodeZZarray(svalues) return n }