Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(20)  |  Call(20)  |  Derive(0)  |  Import(0)

src/s/a/sage-HEAD/src/sage/crypto/classical_cipher.py   sage(Download)
        return isinstance(self, type(other)) and self.parent() == other.parent() and self.key() == other.key()
    def __call__(self, M):
        A = list(D.alphabet())     # plaintext/ciphertext alphabet as a list
        N = self.domain().ngens()  # number of elements in this alphabet
        a, b = self.key()          # encryption/decryption key (a,b)
        # Let I be the index list of M. That is, the i-th element of M has
        # index k in the cipher domain D. We store this cipher domain index
    def __eq__(self, right):
        return isinstance(self, type(right)) and self.parent() == right.parent() and self.key() == right.key()
    def __call__(self, M):
        S = self.domain() # = plaintext_space = ciphertext_space
            raise TypeError("The length of M (= %s) must be a multiple of %s." % (M, m ))
        Alph = list(S.alphabet())
        A = self.key() # A is an m x m matrix
        R = A.parent().base_ring()
        V = FreeModule(R,m)
    def inverse(self):
        E = self.parent()
            B = E.inverse_key(self.key())
        except Exception:

src/s/a/sage-HEAD/src/sage/crypto/stream_cipher.py   sage(Download)
        if not isinstance(M, StringMonoidElement) and M.parent() == B:
            raise TypeError("Argument M (= %s) must be a string in the plaintext space." % M)
        (poly, IS) = self.key()
        n = B.ngens() # two for binary strings
        N = len(M)
            x^2 + x + 1
        return self.key()[0]
    def initial_state(self):
            [0, 1]
        return self.key()[1]
class ShrinkingGeneratorCipher(SymmetricKeyCipher):
            LFSR cipher on Free binary string monoid
        return self.key()[0]
    def decimating_cipher(self):
            LFSR cipher on Free binary string monoid
        return self.key()[1]
    def __call__(self, M, mode = "ECB"):