Skip to content

Commit 60038f5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f06ea41 commit 60038f5

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

cryptography/playfire.ipynb

+17-17
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,41 @@
3333
"source": [
3434
"class PlayFire:\n",
3535
" \"\"\"\n",
36-
" PlayFire class implements the Playfair \n",
36+
" PlayFire class implements the Playfair\n",
3737
" cipher for encryption and decryption of messages.\n",
3838
"\n",
39-
" The Playfair cipher is a digraph substitution \n",
39+
" The Playfair cipher is a digraph substitution\n",
4040
" cipher that encrypts pairs of letters. It requires a key, which\n",
41-
" is used to create a 6x6 matrix of letters and \n",
41+
" is used to create a 6x6 matrix of letters and\n",
4242
" digits, and processes the message in pairs.\n",
4343
"\n",
4444
" Attributes:\n",
4545
" key (str): The key used to generate the matrix.\n",
46-
" key_matrix (list): The 6x6 matrix used for \n",
47-
" encryption and decryption.extra (str): The extra character \n",
46+
" key_matrix (list): The 6x6 matrix used for\n",
47+
" encryption and decryption.extra (str): The extra character\n",
4848
" used to pad the message if the length is odd (default is 'x').\n",
4949
"\n",
5050
" Methods:\n",
51-
" __verify_key(key): Verifies that the key is \n",
51+
" __verify_key(key): Verifies that the key is\n",
5252
" valid (contains unique characters).\n",
53-
" __make_matrix(): Creates a 6x6 matrix using \n",
53+
" __make_matrix(): Creates a 6x6 matrix using\n",
5454
" the key and the remaining letters/digits.\n",
55-
" find_idx(pair): Finds the positions (row and column indices) \n",
55+
" find_idx(pair): Finds the positions (row and column indices)\n",
5656
" of the pair of characters in the matrix.\n",
57-
" encrypt(msg): Encrypts the given message using \n",
57+
" encrypt(msg): Encrypts the given message using\n",
5858
" the Playfair cipher.\n",
59-
" decrypt(msg): Decrypts the given encrypted \n",
59+
" decrypt(msg): Decrypts the given encrypted\n",
6060
" message using the Playfair cipher.\n",
6161
" \"\"\"\n",
6262
"\n",
6363
" def __init__(self, key, extra=\"x\"):\n",
6464
" \"\"\"\n",
65-
" Initializes the PlayFire cipher with a key and \n",
65+
" Initializes the PlayFire cipher with a key and\n",
6666
" an optional extra character for padding.\n",
6767
"\n",
6868
" Parameters:\n",
6969
" key (str): The key to generate the cipher matrix.\n",
70-
" extra (str, optional): The character used for \n",
70+
" extra (str, optional): The character used for\n",
7171
" padding the message if its length is odd. Defaults to 'x'.\n",
7272
" \"\"\"\n",
7373
" self.key = self.__verify_key(key)\n",
@@ -82,7 +82,7 @@
8282
" key (str): The key to verify.\n",
8383
"\n",
8484
" Returns:\n",
85-
" str: The valid key if it contains only unique \n",
85+
" str: The valid key if it contains only unique\n",
8686
" characters, else prints an error.\n",
8787
" \"\"\"\n",
8888
" keyy = []\n",
@@ -96,7 +96,7 @@
9696
"\n",
9797
" def __make_matrix(self):\n",
9898
" \"\"\"\n",
99-
" Creates a 6x6 matrix from the key by filling \n",
99+
" Creates a 6x6 matrix from the key by filling\n",
100100
" in remaining characters of the alphabet and digits.\n",
101101
"\n",
102102
" Returns:\n",
@@ -115,15 +115,15 @@
115115
"\n",
116116
" def find_idx(self, pair):\n",
117117
" \"\"\"\n",
118-
" Finds the row and column indices of the \n",
118+
" Finds the row and column indices of the\n",
119119
" characters in the matrix.\n",
120120
"\n",
121121
" Parameters:\n",
122-
" pair (list): A pair of characters whose \n",
122+
" pair (list): A pair of characters whose\n",
123123
" positions are to be found in the matrix.\n",
124124
"\n",
125125
" Returns:\n",
126-
" list: A list containing the row and column \n",
126+
" list: A list containing the row and column\n",
127127
" indices of both characters in the matrix.\n",
128128
" \"\"\"\n",
129129
" idxs = [6, 6]\n",

0 commit comments

Comments
 (0)