message_cipher.rsa_encrypter module

RSA Encryption module.

The RSA encryption module defines the RsaEncrypter class, a concrete implementation of the Encrypter class. Uses the RSA encryption algorithm to encrypt string messages into arrays of integers.

class message_cipher.rsa_encrypter.RsaEncrypter

Bases: Encrypter

RsaEncrypter performs calculations to encrypt string messages.

__init__(product: int, exponent: int) None

Initialise a new RSA decrypter with specified exponent and product.

Parameters:
  • product (int) – The product of two large prime numbers.

  • exponent (int) – The exponent used for encryption.

Return type:

None

encrypt(plaintext: str) list[int]

Encrypt a message using the RSA system.

Parameters:

plaintext (str) – A message to be encrypted.

Returns:

The encrypted message as an array of integers.

Return type:

list[int]