INNER CODE UNIT · Python

__or__

lschoe/mpyc · demos/PrefixOrExplained.py:96

    def __or__(self, b):
        c = super().__or__(b)
        # self is a secure (secret-shared) integer
        if isinstance(b, secint):
            # b is a secure (secret-shared) integer as well
            c.or_depth = max(self.or_depth, b.or_depth) + 1  # one round of communication for secure or
            secint.or_complexity += 1
        else:
            # b is a public value
            c.or_depth = self.or_depth
        return c

    __ror__ = __or__


# To check the correctness and complexity of our prefix-or implementations we introduce two helper functions. Function `correctness(pf)` tests a given prefix-or function on a range of inputs. Function `complexity(pf, n)` determines the or-complexity and or-depth of `pf` for input lists of length `n`. 

# In[7]:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…