Abstract base class for generators of polynomial systems - Cryptography

Skip to content
Back to top
View this page
Edit this page

# Abstract base class for generators of polynomial systems

AUTHOR:

Martin Albrecht <malb@informatik.uni-bremen.de>

class sage.crypto.mq.mpolynomialsystemgenerator.MPolynomialSystemGenerator

  Bases: `SageObject`

  Abstract base class for generators of polynomial systems.

  block_order()

    Return a block term ordering for the equation systems generated by `self`.

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.block_order()
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.block_order()
        Traceback (most recent call last):
        ...
        NotImplementedError

  polynomial_system(P=None, K=None)

    Return a tuple F,s for plaintext P and key K where F is an polynomial system and s a dictionary which maps key variables to their solutions.

    INPUT:

    - `P` – plaintext (vector, list)

    - `K` – key (vector, list)

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.polynomial_system()
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.polynomial_system()
        Traceback (most recent call last):
        ...
        NotImplementedError

  random_element()

    Return random element. Usually this is a list of elements in the base field of length ‘blocksize’.

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.random_element()
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.random_element()
        Traceback (most recent call last):
        ...
        NotImplementedError

  ring()

    Return the ring in which the system is defined.

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.ring()
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.ring()
        Traceback (most recent call last):
        ...
        NotImplementedError

  sbox()

    Return SBox object for `self`.

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.sbox()
        Traceback (most recent call last):
        ...
        AttributeError: '<class 'sage.crypto.mq.mpolynomialsystemgenerator.MPolynomialSystemGenerator'>' object has no attribute '_sbox'...

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.sbox()
        Traceback (most recent call last):
        ...
        AttributeError: '<class 'sage.crypto.mq.mpolynomialsystemgenerator.MPolynomialSystemGenerator'>' object has no attribute '_sbox'...

  varformatstr(name)

    Return format string for a given name ‘name’ which is understood by print et al.

    Such a format string is used to construct variable names. Typically those format strings are somewhat like ‘name%02d%02d’ such that rounds and offset in a block can be encoded.

    INPUT:

    - `name` – string

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.varformatstr('K')
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.varformatstr('K')
        Traceback (most recent call last):
        ...
        NotImplementedError

  vars(name, round)

    Return a list of variables given a name ‘name’ and an index ‘round’.

    INPUT:

    - `name` – string

    - `round` – integer index

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.vars('K',0)
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.vars('K',Integer(0))
        Traceback (most recent call last):
        ...
        NotImplementedError

  varstrs(name, round)

    Return a list of variable names given a name ‘name’ and an index ‘round’.

    This function is typically used by self._vars.

    INPUT:

    - `name` – string

    - `round` – integer index

    EXAMPLES:

    Sage

        sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        sage: msg = MPolynomialSystemGenerator()
        sage: msg.varstrs('K', i)                                                   # needs sage.all
        Traceback (most recent call last):
        ...
        NotImplementedError

    Python

        >>> from sage.all import *
        >>> from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator
        >>> msg = MPolynomialSystemGenerator()
        >>> msg.varstrs('K', i)                                                   # needs sage.all
        Traceback (most recent call last):
        ...
        NotImplementedError