pyecsca.ec.formula.fliparoo module

Provides a way to Fliparoo formulas.

class Fliparoo(chain, graph)[source]

Bases: object

Fliparoo is a chain of nodes N1->N2->…->Nk in FormulaGraph for k>=2 such that:
  • All Ni are * or All Ni are +/-

  • For every Ni, except for Nk, the only outgoing node is Ni+1

  • Neither of N1,…,Nk-1 is an output node

nodes: List[CodeOpNode]
graph: FormulaGraph
operator: Optional[OpType]
verify_chain(nodes)[source]
property first
property last
previous(node)[source]
Return type:

Optional[CodeOpNode]

deepcopy()[source]
input_nodes()[source]
Return type:

List[Node]

slice(i, j)[source]
class MulFliparoo(chain, graph)[source]

Bases: Fliparoo

operator: Optional[OpType]
deepcopy()
property first
input_nodes()
Return type:

List[Node]

property last
previous(node)
Return type:

Optional[CodeOpNode]

slice(i, j)
verify_chain(nodes)
nodes: List[CodeOpNode]
graph: FormulaGraph
class AddSubFliparoo(chain, graph)[source]

Bases: Fliparoo

deepcopy()
property first
input_nodes()
Return type:

List[Node]

property last
previous(node)
Return type:

Optional[CodeOpNode]

slice(i, j)
verify_chain(nodes)
nodes: List[CodeOpNode]
graph: FormulaGraph
operator: Optional[OpType]
class AddFliparoo(chain, graph)[source]

Bases: Fliparoo

operator: Optional[OpType]
deepcopy()
property first
input_nodes()
Return type:

List[Node]

property last
previous(node)
Return type:

Optional[CodeOpNode]

slice(i, j)
verify_chain(nodes)
nodes: List[CodeOpNode]
graph: FormulaGraph
exception BadFliparoo[source]

Bases: Exception

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

generate_fliparood_formulas(formula, rename=True)[source]
Return type:

Iterator[CodeFormula]

recursive_fliparoo(formula, depth=2)[source]
Return type:

Set[Formula]