Skip to content

Commit

Permalink
gh-36547: expurge parent_old from cryptosystem
Browse files Browse the repository at this point in the history
    
This is removing the import of "parent_old" in crypto folder.

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
    
URL: #36547
Reported by: Frédéric Chapoton
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Oct 29, 2023
2 parents 7c6cda9 + 6d9f69f commit 5c6004b
Showing 1 changed file with 17 additions and 10 deletions.
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 <[email protected]>
#
# 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

0 comments on commit 5c6004b

Please sign in to comment.