Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Ciphers """
#***************************************************************************** # Copyright (C) 2007 David Kohel <kohel@maths.usyd.edu.au> # # Distributed under the terms of the GNU General Public License (GPL) # # http://www.gnu.org/licenses/ #*****************************************************************************
# Ciphers should inherit from morphisms (of sets). # Specific cipher types will implement their functions in terms of the key
""" Cipher class """ """ Create a cipher.
INPUT: Parent and key
EXAMPLES: None yet """
return type(self) is type(right) and self.parent() == right.parent() and self._key == right._key
r""" Return the string representation of this cipher.
EXAMPLES::
sage: S = ShiftCryptosystem(AlphabeticStrings()) sage: S(13) Shift cipher on Free alphabetic string monoid on A-Z """ # return str(self._key)
return self.parent().cipher_codomain()
""" Symmetric key cipher class """ """ Create a symmetric cipher
INPUT: Parent and key
EXAMPLES: None yet """
""" Public key cipher class """ """ Create a public key cipher
INPUT: Parent and key
EXAMPLES: None yet """ Cipher.__init__(self, parent, key) self._public = public |