message_cipher.affine_cipher module

Affine Cipher module.

This module defines the AffineCipher class, which is a concrete implementation of the Mod26Cipher class.

The AffineCipher class uses the Affine cipher algorithm for encryption and decryption.

class message_cipher.affine_cipher.AffineCipher(degree_one: int, degree_zero: int)

Bases: Mod26Cipher

AffineCipher performs calculations to encrypt and decrypt strings of alphabetic characters using the Affine Cipher algorithm.

Parameters:
  • degree_one (int)

  • degree_zero (int)

INVERTIBLE_ELEMENTS = [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]
message_cipher.affine_cipher.inverse_modulo_26(number: int) int

Calculates the multiplicative inverse of number modulo 26.

Parameters:

number (int) – A number to calculate the inverse of.

Returns:

The multiplicative inverse of number.

Return type:

int