code stringlengths 17 6.64M |
|---|
class FiniteWordPath_north_east_callable_with_caching(WordDatatype_callable_with_caching, FiniteWordPath_north_east, FiniteWord_class):
pass
|
class FiniteWordPath_north_east_callable(WordDatatype_callable, FiniteWordPath_north_east, FiniteWord_class):
pass
|
class FiniteWordPath_dyck_list(WordDatatype_list, FiniteWordPath_dyck, FiniteWord_class):
"\n TESTS::\n\n sage: P = WordPaths('ab', steps='dyck')\n sage: p = P(['a','b','b']); p\n Path: abb\n sage: type(p)\n <class 'sage.combinat.words.paths.FiniteWordPath_dyck_list'>\n ... |
class FiniteWordPath_dyck_str(WordDatatype_str, FiniteWordPath_dyck, FiniteWord_class):
"\n TESTS::\n\n sage: P = WordPaths('ab', steps='dyck')\n sage: p = P('abb'); p\n Path: abb\n sage: type(p)\n <class 'sage.combinat.words.paths.FiniteWordPath_dyck_str'>\n sage: p =... |
class FiniteWordPath_dyck_tuple(WordDatatype_tuple, FiniteWordPath_dyck, FiniteWord_class):
"\n TESTS::\n\n sage: P = WordPaths('ab', steps='dyck')\n sage: p = P(('a','b','b')); p\n Path: abb\n sage: type(p)\n <class 'sage.combinat.words.paths.FiniteWordPath_dyck_tuple'>\n ... |
class FiniteWordPath_dyck_iter_with_caching(WordDatatype_iter_with_caching, FiniteWordPath_dyck, FiniteWord_class):
pass
|
class FiniteWordPath_dyck_iter(WordDatatype_iter, FiniteWordPath_dyck, FiniteWord_class):
pass
|
class FiniteWordPath_dyck_callable_with_caching(WordDatatype_callable_with_caching, FiniteWordPath_dyck, FiniteWord_class):
pass
|
class FiniteWordPath_dyck_callable(WordDatatype_callable, FiniteWordPath_dyck, FiniteWord_class):
pass
|
class ShuffleProduct_w1w2(Parent, UniqueRepresentation):
def __init__(self, w1, w2, check=True):
'\n The shuffle product of the two words ``w1`` and ``w2``.\n\n If `u` and `v` are two words, then the *shuffle product* of\n `u` and `v` is a certain multiset of words defined as follows... |
class ShuffleProduct_shifted(ShuffleProduct_w1w2):
def __init__(self, w1, w2, check=True):
'\n Shifted shuffle product of ``w1`` with ``w2``.\n\n This is the shuffle product of ``w1`` with the word\n obtained by adding the length of ``w1`` to every letter\n of ``w2``.\n\n ... |
class SuffixTrie(SageObject):
def __init__(self, word):
'\n Construct the suffix trie of the word w.\n\n The suffix trie of a finite word w is a data structure representing\n the factors of w. It is a tree whose edges are labelled with\n letters of w, and whose leafs correspon... |
class ImplicitSuffixTree(SageObject):
def __init__(self, word):
'\n Construct the implicit suffix tree of a word w.\n\n The suffix tree of a word w is a compactification of the suffix\n trie for w. The compactification removes all nodes that have\n exactly one incoming edge an... |
class DecoratedSuffixTree(ImplicitSuffixTree):
"\n The decorated suffix tree of a word.\n\n A *decorated suffix tree* of a word `w` is the suffix tree of `w`\n marked with the end point of all squares in the `w`.\n\n The symbol ``$`` is appended to ``w`` to ensure that each final\n state is a leaf ... |
def Word(data=None, alphabet=None, length=None, datatype=None, caching=True, RSK_data=None):
'\n Construct a word.\n\n INPUT:\n\n - ``data`` -- (default: ``None``) list, string, tuple, iterator, free\n monoid element, ``None`` (shorthand for ``[]``), or a callable defined\n on ``[0,1,...,len... |
class FiniteWord_char(WordDatatype_char, FiniteWord_class):
"\n Finite word represented by an array ``unsigned char *`` (i.e. integers\n between 0 and 255).\n\n For any word ``w``, type ``w.<TAB>`` to see the functions that can be applied\n to ``w``.\n\n EXAMPLES::\n\n sage: W = Words(range(... |
class FiniteWord_list(WordDatatype_list, FiniteWord_class):
'\n Finite word represented by a Python list.\n\n For any word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: w = Word(range(10))\n sage: w.iterated_right_palindro... |
class FiniteWord_str(WordDatatype_str, FiniteWord_class):
"\n Finite word represented by a Python str.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: w = Word('abcdef')\n sage: w.is_square()\n False... |
class FiniteWord_tuple(WordDatatype_tuple, FiniteWord_class):
'\n Finite word represented by a Python tuple.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: w = Word(())\n sage: w.is_empty()\n True\n... |
class FiniteWord_iter_with_caching(WordDatatype_iter_with_caching, FiniteWord_class):
"\n Finite word represented by an iterator (with caching).\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: w = Word(iter('abcde... |
class FiniteWord_iter(WordDatatype_iter, FiniteWord_class):
"\n Finite word represented by an iterator.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: w = Word(iter(range(10)), caching=False)\n sage: w\n ... |
class FiniteWord_callable_with_caching(WordDatatype_callable_with_caching, FiniteWord_class):
"\n Finite word represented by a callable (with caching).\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: f = lambda n ... |
class FiniteWord_callable(WordDatatype_callable, FiniteWord_class):
"\n Finite word represented by a callable.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: f = lambda n : 3 if n > 8 else 6\n sage: w = Wo... |
class InfiniteWord_iter_with_caching(WordDatatype_iter_with_caching, InfiniteWord_class):
"\n Infinite word represented by an iterable (with caching).\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n Infinite words behave like a Python list :... |
class InfiniteWord_iter(WordDatatype_iter, InfiniteWord_class):
"\n Infinite word represented by an iterable.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n Infinite words behave like a Python list : they can be sliced using\n square bra... |
class InfiniteWord_callable_with_caching(WordDatatype_callable_with_caching, InfiniteWord_class):
"\n Infinite word represented by a callable (with caching).\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n Infinite words behave like a Python... |
class InfiniteWord_callable(WordDatatype_callable, InfiniteWord_class):
"\n Infinite word represented by a callable.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n Infinite words behave like a Python list : they can be sliced using\n squ... |
class Word_iter_with_caching(WordDatatype_iter_with_caching, Word_class):
"\n Word of unknown length (finite or infinite) represented by an\n iterable (with caching).\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n Words behave like a Pyt... |
class Word_iter(WordDatatype_iter, Word_class):
"\n Word of unknown length (finite or infinite) represented by an\n iterable.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n Words behave like a Python list : they can be sliced using\n ... |
class FiniteWord_morphic(WordDatatype_morphic, FiniteWord_class):
'\n Finite morphic word.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n EXAMPLES::\n\n sage: m = WordMorphism("a->ab,b->")\n sage: w = m.fixed_point("a")\n ... |
class InfiniteWord_morphic(WordDatatype_morphic, InfiniteWord_class):
"\n Morphic word of infinite length.\n\n For such word `w`, type ``w.`` and hit :kbd:`Tab` key to see the list of\n functions defined on `w`.\n\n Infinite words behave like a Python list : they can be sliced using\n square braque... |
def _build_tab(sym, tab, W):
'\n Internal function building a coding table for the ``phi_inv_tab`` function.\n\n TESTS::\n\n sage: from sage.combinat.words.word_generators import _build_tab\n sage: _build_tab(1, [], Words([1, 2]))\n [1]\n sage: _build_tab(1, [1], Words([1, 2]))\n... |
class LowerChristoffelWord(FiniteWord_list):
"\n Returns the lower Christoffel word of slope `p/q`, where `p` and\n `q` are relatively prime non-negative integers, over the given\n two-letter alphabet.\n\n The *Christoffel word of slope `p/q`* is obtained from the\n Cayley graph of `\\ZZ/(p+q)\\ZZ`... |
class WordGenerator():
"\n Constructor of several famous words.\n\n EXAMPLES::\n\n sage: words.ThueMorseWord()\n word: 0110100110010110100101100110100110010110...\n\n ::\n\n sage: words.FibonacciWord()\n word: 0100101001001010010100100101001001010010...\n\n ::\n\n sa... |
class WordDatatype_callable(WordDatatype):
'\n Datatype for a word defined by a callable.\n '
def __init__(self, parent, callable, length=None):
"\n INPUT:\n\n - ``parent`` - a parent\n - ``callable`` - a callable defined on ``range(stop=length)``\n - ``length`` - ... |
class WordDatatype_callable_with_caching(WordDatatype_callable):
'\n Datatype for a word defined by a callable.\n '
def __init__(self, parent, callable, length=None):
"\n INPUT:\n\n - ``parent`` - a parent\n - ``callable`` - a callable defined on ``range(stop=length)``\n ... |
class WordDatatype_iter(WordDatatype):
def __init__(self, parent, iter, length=None):
'\n INPUT:\n\n - ``parent`` - a parent\n - ``iter`` - an iterator\n - ``length`` - (default: ``None``) the length of the word\n\n EXAMPLES::\n\n sage: w = Word(iter("abbab... |
class WordDatatype_iter_with_caching(WordDatatype_iter):
def __init__(self, parent, iter, length=None):
'\n INPUT:\n\n - ``parent`` - a parent\n - ``iter`` - an iterator\n - ``length`` - (default: ``None``) the length of the word\n\n EXAMPLES::\n\n sage: im... |
def WordOptions(**kwargs):
'\n Sets the global options for elements of the word class.\n The defaults are for words to be displayed in list notation.\n\n INPUT:\n\n - ``display`` - \'string\' (default), or \'list\', words are displayed in\n string or list notation.\n - ``truncate`` - boolea... |
def Words(alphabet=None, length=None, finite=True, infinite=True):
"\n Returns the combinatorial class of words of length k over an alphabet.\n\n EXAMPLES::\n\n sage: Words()\n Finite and infinite words over Set of Python objects of class 'object'\n sage: Words(length=7)\n Words ... |
class AbstractLanguage(Parent):
'\n Abstract base class\n\n This is *not* to be used by any means. This class gather previous features\n of set of words (prior to :trac:`19619`). In the future that class might\n simply disappear or become a common base class for all languages. In the\n latter case,... |
class FiniteWords(AbstractLanguage):
"\n The set of finite words over a fixed alphabet.\n\n EXAMPLES::\n\n sage: W = FiniteWords('ab')\n sage: W\n Finite words over {'a', 'b'}\n "
def cardinality(self):
"\n Return the cardinality of this set.\n\n EXAMPLES::... |
class InfiniteWords(AbstractLanguage):
def cardinality(self):
"\n Return the cardinality of this set\n\n EXAMPLES::\n\n sage: InfiniteWords('ab').cardinality()\n +Infinity\n sage: InfiniteWords('a').cardinality()\n 1\n sage: InfiniteWor... |
class FiniteOrInfiniteWords(AbstractLanguage):
def __init__(self, alphabet):
'\n INPUT:\n\n - ``alphabet`` -- the underlying alphabet\n\n TESTS::\n\n sage: loads(dumps(Words())) == Words()\n True\n '
AbstractLanguage.__init__(self, alphabet)
... |
class Words_n(Parent):
'\n The set of words of fixed length on a given alphabet.\n '
def __init__(self, words, n):
'\n INPUT:\n\n - ``words`` -- a set of finite words\n\n - ``n`` -- a non-negative integer\n\n TESTS::\n\n sage: Words([0,1], length=-42)\n ... |
def YangBaxterGraph(partition=None, root=None, operators=None):
'\n Construct the Yang-Baxter graph from ``root`` by repeated application of\n ``operators``, or the Yang-Baxter graph associated to ``partition``.\n\n INPUT:\n\n The user needs to provide either ``partition`` or both ``root`` and\n ``... |
class YangBaxterGraph_generic(SageObject):
def __init__(self, root, operators):
'\n A class to model the Yang-Baxter graph defined by ``root`` and\n ``operators``.\n\n INPUT:\n\n - ``root`` -- the root vertex of the graph\n\n - ``operators`` -- a list of callables that ... |
class YangBaxterGraph_partition(YangBaxterGraph_generic):
def __init__(self, partition):
'\n A class to model the Yang-Baxter graph of a partition.\n\n The Yang-Baxter graph defined by a partition `[p_1,\\dots,p_k]`\n is the labelled directed graph with vertex set obtained by\n ... |
class SwapOperator(SageObject):
def __init__(self, i):
'\n The operator that swaps the items in positions ``i`` and ``i+1``.\n\n EXAMPLES::\n\n sage: from sage.combinat.yang_baxter_graph import SwapOperator\n sage: s3 = SwapOperator(3)\n sage: s3 == loads(du... |
class SwapIncreasingOperator(SwapOperator):
def __repr__(self):
"\n Representation string.\n\n EXAMPLES::\n\n sage: from sage.combinat.yang_baxter_graph import SwapIncreasingOperator\n sage: s3 = SwapIncreasingOperator(3)\n sage: s3.__repr__()\n '... |
class Random(_random.Random):
"Random number generator base class used by bound module functions.\n\n Used to instantiate instances of Random to get generators that don't\n share state. Especially useful for multi-threaded programs, creating\n a different instance of Random for each thread, and using th... |
class DES(SageObject):
'\n This class implements DES described in [U.S1999]_.\n\n EXAMPLES:\n\n You can invoke DES encryption/decryption either by calling DES with an\n appropriate flag::\n\n sage: from sage.crypto.block_cipher.des import DES\n sage: des = DES()\n sage: P = 0x8000... |
class DES_KS(SageObject):
"\n This class implements the DES key schedules described in [U.S1999]_.\n\n EXAMPLES:\n\n Initialise the key schedule with a `masterKey` to use it as an iterable::\n\n sage: from sage.crypto.block_cipher.des import DES_KS\n sage: ks = DES_KS(masterKey=0)\n ... |
def convert_to_vector(I, L):
'\n Convert ``I`` to a bit vector of length ``L``.\n\n INPUT:\n\n - ``I`` -- integer or bit list-like\n\n - ``L`` -- integer; the desired bit length of the ouput\n\n OUTPUT:\n\n - the ``L``-bit vector representation of ``I``\n\n EXAMPLES::\n\n sage: from sa... |
class MiniAES(SageObject):
'\n This class implements the Mini Advanced Encryption Standard (Mini-AES)\n described in [Pha2002]_. Note that Phan\'s Mini-AES is for educational purposes\n only and is not secure for practical purposes. Mini-AES is a version of\n the AES with all parameters significantly ... |
def _smallscale_present_linearlayer(nsboxes=16):
'\n .. TODO::\n\n switch to sage.crypto.linearlayer\n (:trac:`25735`) as soon as it is included in sage\n\n EXAMPLES::\n\n sage: from sage.crypto.block_cipher.present import _smallscale_present_linearlayer\n sage: _smallscale_prese... |
class PRESENT(SageObject):
"\n This class implements PRESENT described in [BKLPPRSV2007]_.\n\n EXAMPLES:\n\n You can invoke PRESENT encryption/decryption either by calling PRESENT with\n an appropriate flag::\n\n sage: from sage.crypto.block_cipher.present import PRESENT\n sage: present ... |
class PRESENT_KS(SageObject):
'\n This class implements the PRESENT key schedules for both 80-bit and 128-bit\n keys as described in [BKLPPRSV2007]_.\n\n EXAMPLES:\n\n Initialise the key schedule with a `master\\_key` to use it as an iterable::\n\n sage: from sage.crypto.block_cipher.present im... |
def convert_to_vector(I, L):
'\n Convert ``I`` to a bit vector of length ``L``.\n\n INPUT:\n\n - ``I`` -- integer or bit list-like\n\n - ``L`` -- integer; the desired bit length of the ouput\n\n OUTPUT:\n\n - the ``L``-bit vector representation of ``I``\n\n EXAMPLES::\n\n sage: from sa... |
class SimplifiedDES(SageObject):
'\n This class implements the Simplified Data Encryption Standard (S-DES)\n described in [Sch1996]_. Schaefer\'s S-DES is for educational purposes\n only and is not secure for practical purposes. S-DES is a version of\n the DES with all parameters significantly reduced... |
class Cipher(Element):
'\n Cipher class\n '
def __init__(self, parent, key):
'\n Create a cipher.\n\n INPUT: Parent and key\n\n EXAMPLES: None yet\n '
Element.__init__(self, parent)
self._key = key
def __eq__(self, right):
return ((type(s... |
class SymmetricKeyCipher(Cipher):
'\n Symmetric key cipher class\n '
def __init__(self, parent, key):
'\n Create a symmetric cipher\n\n INPUT: Parent and key\n\n EXAMPLES: None yet\n '
Cipher.__init__(self, parent, key)
|
class PublicKeyCipher(Cipher):
'\n Public key cipher class\n '
def __init__(self, parent, key, public=True):
'\n Create a public key cipher\n\n INPUT: Parent and key\n\n EXAMPLES: None yet\n '
Cipher.__init__(self, parent, key)
self._public = public
|
class AffineCryptosystem(SymmetricKeyCryptosystem):
'\n Create an affine cryptosystem.\n\n Let `A = \\{ a_0, a_1, a_2, \\dots, a_{n-1} \\}` be a non-empty alphabet\n consisting of `n` unique elements. Define a mapping\n `f : A \\longrightarrow \\ZZ / n\\ZZ` from the alphabet `A` to\n the set `\\ZZ ... |
class HillCryptosystem(SymmetricKeyCryptosystem):
'\n Create a Hill cryptosystem defined by the `m \\times m` matrix space\n over `\\ZZ / N \\ZZ`, where `N` is the alphabet size of\n the string monoid ``S``.\n\n INPUT:\n\n - ``S`` - a string monoid over some alphabet\n\n - ``m`` - integer `> 0`;... |
class ShiftCryptosystem(SymmetricKeyCryptosystem):
'\n Create a shift cryptosystem.\n\n Let `A = \\{ a_0, a_1, a_2, \\dots, a_{n-1} \\}` be a non-empty alphabet\n consisting of `n` unique elements. Define a mapping\n `f : A \\longrightarrow \\ZZ/ n\\ZZ` from the alphabet `A` to\n the set `\\ZZ / n\... |
class SubstitutionCryptosystem(SymmetricKeyCryptosystem):
'\n Create a substitution cryptosystem.\n\n INPUT:\n\n - ``S`` - a string monoid over some alphabet\n\n OUTPUT:\n\n - A substitution cryptosystem over the alphabet ``S``.\n\n EXAMPLES::\n\n sage: M = AlphabeticStrings()\n sa... |
class TranspositionCryptosystem(SymmetricKeyCryptosystem):
'\n Create a transposition cryptosystem of block length ``n``.\n\n INPUT:\n\n - ``S`` - a string monoid over some alphabet\n\n - ``n`` - integer `> 0`; a block length of a block permutation\n\n OUTPUT:\n\n - A transposition cryptosystem ... |
class VigenereCryptosystem(SymmetricKeyCryptosystem):
'\n Create a Vigenere cryptosystem of block length ``n``.\n\n INPUT:\n\n - ``S``-- a string monoid over some alphabet\n\n - ``n`` -- integer `> 0`; block length of an encryption/decryption key\n\n OUTPUT:\n\n - A Vigenere cryptosystem of bloc... |
class AffineCipher(SymmetricKeyCipher):
'\n Affine cipher class. This is the class that does the actual work of\n encryption and decryption. Users should not directly instantiate or\n create objects of this class. Instead, functionalities of this class\n should be accessed via\n :class:`AffineCrypt... |
class HillCipher(SymmetricKeyCipher):
'\n Hill cipher class\n '
def __init__(self, parent, key):
'\n Create a Hill cipher.\n\n INPUT: Parent and key\n\n EXAMPLES::\n\n sage: # needs sage.modules\n sage: S = AlphabeticStrings()\n sage: E = Hi... |
class ShiftCipher(SymmetricKeyCipher):
'\n Shift cipher class. This is the class that does the actual work of\n encryption and decryption. Users should not directly instantiate or\n create objects of this class. Instead, functionalities of this class\n should be accessed via\n :class:`ShiftCryptosy... |
class SubstitutionCipher(SymmetricKeyCipher):
'\n Substitution cipher class\n '
def __init__(self, parent, key):
'\n Create a substitution cipher.\n\n INPUT: Parent and key\n\n EXAMPLES::\n\n sage: S = AlphabeticStrings()\n sage: E = SubstitutionCrypto... |
class TranspositionCipher(SymmetricKeyCipher):
'\n Transition cipher class\n '
def __init__(self, parent, key):
'\n Create a transposition cipher.\n\n INPUT: Parent and key\n\n EXAMPLES::\n\n sage: # needs sage.groups\n sage: S = AlphabeticStrings()\n ... |
class VigenereCipher(SymmetricKeyCipher):
'\n Vigenere cipher class\n '
def __init__(self, parent, key):
'\n Create a Vigenere cipher.\n\n INPUT: Parent and key\n\n EXAMPLES::\n\n sage: S = AlphabeticStrings()\n sage: E = VigenereCryptosystem(S,11)\n ... |
class Cryptosystem(Set_generic):
'\n A base cryptosystem class. This is meant to be extended by other\n specialized child classes that implement specific cryptosystems.\n\n A cryptosystem is a pair of maps\n\n .. MATH::\n\n E : {\\mathcal K} \\rightarrow {\\rm Hom}({\\mathcal M},{\\mathcal C})\... |
class SymmetricKeyCryptosystem(Cryptosystem):
'\n The base class for symmetric key, or secret key, cryptosystems.\n '
def alphabet_size(self):
'\n Return the number of elements in the alphabet of this\n cryptosystem. This only applies to any cryptosystem whose plaintext\n a... |
class PublicKeyCryptosystem(Cryptosystem):
'\n The base class for asymmetric or public-key cryptosystems.\n '
|
def gen_lattice(type='modular', n=4, m=8, q=11, seed=None, quotient=None, dual=False, ntl=False, lattice=False):
"\n This function generates different types of integral lattice bases\n of row vectors relevant in cryptography.\n\n Randomness can be set either with ``seed``, or by using\n :func:`sage.mi... |
def lfsr_sequence(key, fill, n):
"\n Create an LFSR sequence.\n\n INPUT:\n\n - ``key`` -- a list of finite field elements, `[c_0, c_1,\\dots, c_k]`\n\n - ``fill`` -- the list of the initial terms of the LFSR sequence, `[x_0,x_1,\\dots,x_k]`\n\n - ``n`` -- number of terms of the sequence that the fu... |
def lfsr_autocorrelation(L, p, k):
'\n INPUT:\n\n - ``L`` -- a periodic sequence of elements of ZZ or GF(2); must have length `p`\n\n - ``p`` -- the period of `L`\n\n - ``k`` -- an integer between `0` and `p`\n\n OUTPUT: autocorrelation sequence of `L`\n\n EXAMPLES::\n\n sage: F = GF(2)\n... |
def lfsr_connection_polynomial(s):
"\n INPUT:\n\n - ``s`` -- a sequence of elements of a finite field of even length\n\n OUTPUT:\n\n - ``C(x)`` -- the connection polynomial of the minimal LFSR.\n\n This implements the algorithm in section 3 of J. L. Massey's article\n [Mas1969]_.\n\n EXAMPLES... |
class UniformSampler(SageObject):
'\n Uniform sampling in a range of integers.\n\n EXAMPLES::\n\n sage: from sage.crypto.lwe import UniformSampler\n sage: sampler = UniformSampler(-2, 2); sampler\n UniformSampler(-2, 2)\n sage: sampler() in range(-2, 3)\n True\n\n .. au... |
class UniformPolynomialSampler(SageObject):
"\n Uniform sampler for polynomials.\n\n EXAMPLES::\n\n sage: from sage.crypto.lwe import UniformPolynomialSampler\n sage: UniformPolynomialSampler(ZZ['x'], 8, -2, 2)().parent()\n Univariate Polynomial Ring in x over Integer Ring\n\n .. aut... |
class LWE(SageObject):
'\n Learning with Errors (LWE) oracle.\n\n .. automethod:: __init__\n .. automethod:: __call__\n '
def __init__(self, n, q, D, secret_dist='uniform', m=None):
'\n Construct an LWE oracle in dimension ``n`` over a ring of order\n ``q`` with noise distri... |
class Regev(LWE):
'\n LWE oracle with parameters as in [Reg09]_.\n\n .. automethod:: __init__\n '
def __init__(self, n, secret_dist='uniform', m=None):
"\n Construct LWE instance parameterised by security parameter ``n`` where\n the modulus ``q`` and the ``stddev`` of the noise... |
class LindnerPeikert(LWE):
'\n LWE oracle with parameters as in [LP2011]_.\n\n .. automethod:: __init__\n '
def __init__(self, n, delta=0.01, m=None):
"\n Construct LWE instance parameterised by security parameter ``n`` where\n the modulus ``q`` and the ``stddev`` of the noise ... |
class UniformNoiseLWE(LWE):
'\n LWE oracle with uniform secret with parameters as in [CGW2013]_.\n\n .. automethod:: __init__\n '
def __init__(self, n, instance='key', m=None):
'\n Construct LWE instance parameterised by security parameter ``n`` where\n all other parameters are... |
class RingLWE(SageObject):
'\n Ring Learning with Errors oracle.\n\n .. automethod:: __init__\n .. automethod:: __call__\n '
def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None):
"\n Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order\n ... |
class RingLindnerPeikert(RingLWE):
'\n Ring-LWE oracle with parameters as in [LP2011]_.\n\n .. automethod:: __init__\n '
def __init__(self, N, delta=0.01, m=None):
"\n Construct a Ring-LWE oracle in dimension ``n=phi(N)`` where\n the modulus ``q`` and the ``stddev`` of the nois... |
class RingLWEConverter(SageObject):
'\n Wrapper callable to convert Ring-LWE oracles into LWE oracles by\n disregarding the additional structure.\n\n .. automethod:: __init__\n .. automethod:: __call__\n '
def __init__(self, ringlwe):
"\n INPUT:\n\n - ``ringlwe`` - an ins... |
def samples(m, n, lwe, seed=None, balanced=False, **kwds):
'\n Return ``m`` LWE samples.\n\n INPUT:\n\n - ``m`` - the number of samples (integer > 0)\n - ``n`` - the security parameter (integer > 0)\n - ``lwe`` - either\n\n - a subclass of :class:`LWE` such as :class:`Regev` or :class:`Lindner... |
def balance_sample(s, q=None):
"\n Given ``(a,c) = s`` return a tuple ``(a',c')`` where ``a'`` is an integer\n vector with entries between -q//2 and q//2 and ``c`` is also within these\n bounds.\n\n If ``q`` is given ``(a,c) = s`` may live in the integers. If ``q`` is not\n given, then ``(a,c)`` ar... |
class MPolynomialSystemGenerator(SageObject):
'\n Abstract base class for generators of polynomial systems.\n '
def __getattr__(self, attr):
'\n EXAMPLES::\n\n sage: from sage.crypto.mq.mpolynomialsystemgenerator import MPolynomialSystemGenerator\n sage: msg = MPoly... |
class RijndaelGF(SageObject):
def __init__(self, Nb, Nk, state_chr='a', key_chr='k'):
"\n An algebraically generalized version of the AES cipher.\n\n INPUT:\n\n - ``Nb`` -- The block length of this instantiation. Must be between 4\n and 8.\n\n - ``Nk`` -- The key leng... |
def SR(n=1, r=1, c=1, e=4, star=False, **kwargs):
"\n Return a small scale variant of the AES polynomial system\n constructor subject to the following conditions:\n\n INPUT:\n\n - ``n`` - the number of rounds (default: 1)\n - ``r`` - the number of rows in the state array (default: 1)\n - ``c`... |
class SR_generic(MPolynomialSystemGenerator):
def __init__(self, n=1, r=1, c=1, e=4, star=False, **kwargs):
'\n Small Scale Variants of the AES.\n\n EXAMPLES::\n\n sage: sr = mq.SR(1, 1, 1, 4)\n sage: ShiftRows = sr.shift_rows_matrix()\n sage: MixColumns = s... |
class SR_gf2n(SR_generic):
'\n Small Scale Variants of the AES polynomial system constructor over\n `\\GF{2^n}`.\n '
def vector(self, d=None):
'\n Constructs a vector suitable for the algebraic representation of\n SR, i.e. BES.\n\n INPUT:\n\n - ``d`` - values for... |
class SR_gf2(SR_generic):
def __init__(self, n=1, r=1, c=1, e=4, star=False, **kwargs):
'\n Small Scale Variants of the AES polynomial system constructor over\n `\\GF{2}`. See help for SR.\n\n EXAMPLES::\n\n sage: sr = mq.SR(gf2=True)\n sage: sr\n SR(... |
class SR_gf2_2(SR_gf2):
'\n This is an example how to customize the SR constructor.\n\n In this example, we replace the S-Box inversion polynomials by the\n polynomials generated by the S-Box class.\n '
def inversion_polynomials_single_sbox(self, x=None, w=None, biaffine_only=None, correct_only=N... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.