CrackingCodes.Ch01 package¶
Submodules¶
CrackingCodes.Ch01.PracticeQuestions module¶
Chapter 1 Practice Questions.
Answers Chapter 1 Practice Questions via Python code.
Notes
- Contains spoilers from Chapter 5 (caesar cipher), Chapter 6 (caesar hacker), and Chapter 7 (functions)
- Corrections submitted for Questions 1, 3, 4, and 5
CrackingCodes.Ch01.caesarCipher module¶
Caesar Cipher improved.
Rewritten as function with wrapper functions for importing.
Note
Contains spoilers from Chapter 5 (caesarCipher) and Chapter 7 (functions)
-
CrackingCodes.Ch01.caesarCipher.
caesarCipher
(key: int, message: str, mode: str) → str[source]¶ Implement caesar cipher.
Encrypts or decrypts given message with given key depending on given mode.
Parameters: - key – Key to use for [de|en]cryption.
- message – Message to encrypt/decrypt.
- mode – Specifies encryption or decryption.
Returns: Encrypted/decrypted message string.
Example
>>> from pythontutorials.books.CrackingCodes.Ch01.caesarCipher import caesarCipher >>> caesarCipher(4, 'IMPIETY: YOUR IRREVERENCE TOWARD MY DEITY.', 'encrypt') 'MQTMIXc:AcSYVAMVVIZIVIRGIAXSaEVHAQcAHIMXcD'
-
CrackingCodes.Ch01.caesarCipher.
decryptMessage
(key: int, message: str) → str[source]¶ Decrypts encrypted caesar cipher.
Wrapper function that calls caesarCipher() to decrypt given message with given key.
Parameters: - key – Key to use to decrypt message.
- message – Message to decrypt.
Returns: Decrypted message string.
-
CrackingCodes.Ch01.caesarCipher.
encryptMessage
(key: int, message: str) → str[source]¶ Encrypts message with caesar cipher.
Wrapper function that calls caesarCipher() to encrypt given message with given key.
Parameters: - key – Key to use to encrypt message.
- message – Message to encrypt.
Returns: Encrypted message string.
CrackingCodes.Ch01.caesarHacker module¶
Caesar Hacker improved.
Rewritten as function for importing.
Note
Contains spoilers from Chapter 6 (caesarHacker) and Chapter 7 (functions)
CrackingCodes.Ch01.constants module¶
Configuration file with global variables.
Mainly contains definition of every possible encryptable symbol.