Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expurge parent_old from cryptosystem #36547

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/sage/crypto/cryptosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
This module contains base classes for various cryptosystems, including
symmetric key and public-key cryptosystems. The classes defined in this
module should not be called directly. It is the responsibility of child
classes to implement specific cryptosystems. Take for example the
classes to implement specific cryptosystems.
Take for example the
Hill or matrix cryptosystem as implemented in
:class:`HillCryptosystem <sage.crypto.classical.HillCryptosystem>`. It is a
symmetric key cipher so
Expand All @@ -27,22 +29,21 @@ class of
| + VigenereCryptosystem
+ PublicKeyCryptosystem
"""

#*****************************************************************************
# ****************************************************************************
# 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/
#*****************************************************************************

import sage.structure.parent_old as parent_old
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.sets.set import Set_generic

class Cryptosystem(parent_old.Parent, Set_generic):

class Cryptosystem(Set_generic):
r"""
A base cryptosystem class. This is meant to be extended by other
specialized child classes that implement specific cryptosystems.
A cryptosystem is a pair of maps
.. MATH::
Expand Down Expand Up @@ -143,7 +144,9 @@ def __init__(self, plaintext_space, ciphertext_space, key_space,

def __eq__(self, right):
r"""
Comparing ``self`` with ``right``. Two ``Cryptosystem`` objects
Comparing ``self`` with ``right``.
Two ``Cryptosystem`` objects
are the same if they satisfy all of these conditions:
- share the same type
Expand Down Expand Up @@ -323,7 +326,9 @@ def key_space(self):

def block_length(self):
r"""
Return the block length of this cryptosystem. For some cryptosystems
Return the block length of this cryptosystem.
For some cryptosystems
this is not relevant, in which case the block length defaults to 1.
EXAMPLES:
Expand All @@ -348,6 +353,7 @@ def period(self):
raise TypeError("Argument has no associated period.")
return self._period


class SymmetricKeyCryptosystem(Cryptosystem):
r"""
The base class for symmetric key, or secret key, cryptosystems.
Expand All @@ -373,6 +379,7 @@ def alphabet_size(self):
"""
return self._cipher_domain.ngens()


class PublicKeyCryptosystem(Cryptosystem):
r"""
The base class for asymmetric or public-key cryptosystems.
Expand Down