msp

This class is adapted from the SecretUtil class in charm/toolbox/secretutil.py. It provides the following methods: - createPolicy: convert a Boolean formula encoded as a string into a policy represented like a tree; - convertPolicyToMSP: convert a policy into a monotone span program (MSP); - getCoefficients: given a policy, returns a coefficient for every attribute; - strip_index: remove the index from an attribute (i.e., x_y -> x); - prune: determine whether a given set of attributes satisfies the policy

(returns false if it doesn’t, otherwise a good enough subset of attributes);
  • getAttributeList: retrieve the attributes that occur in a policy tree in order (left to right).
class msp.MSP(groupObj, verbose=True)[source]

Bases: object

convert_policy_to_msp(tree)[source]

Convert a policy into a monotone span program (MSP) represented by a dictionary with (attribute, row) pairs

createPolicy(policy_string)[source]

Convert a Boolean formula represented as a string into a policy represented like a tree.

getAttributeList(Node)[source]

Retrieve the attributes that occur in a policy tree in order (left to right).

getCoefficients(tree)[source]

Given a policy, returns a coefficient for every attribute.

prune(policy, attributes)[source]

Determine whether a given set of attributes satisfies the policy (returns false if it doesn’t, otherwise a good enough subset of attributes).

recoverCoefficients(list)[source]

recovers the coefficients over a binary tree.

strip_index(node_str)[source]

Remove the index from an attribute (i.e., x_y -> x).