23 lines
937 B
Markdown
23 lines
937 B
Markdown
|
|
# Autokey Cipher
|
|
|
|
Encrypts or decrypts a message using the Autokey cipher.
|
|
|
|
Source library: `secretpy`
|
|
|
|
## Historical Context
|
|
|
|
The Autokey cipher is a polyalphabetic substitution cipher that was invented by Girolamo Cardano in 1550. It is similar to the Vigenère cipher, but it uses the plaintext itself to extend the key.
|
|
|
|
## How it Works
|
|
|
|
The Autokey cipher uses a keyword to start the encryption process. The rest of the key is generated by taking the plaintext of the message. The encryption is then performed using a tabula recta, similar to the Vigenère cipher.
|
|
|
|
## Parameters
|
|
|
|
- **text**: The message to encrypt or decrypt.
|
|
- **alphabet**: The alphabet to use for the cipher. Can be a string of characters or a predefined alphabet from `secretpy.alphabets`.
|
|
- **key**: The key for the cipher.
|
|
- **mode**: Whether to encrypt or decrypt the message.
|
|
- **keep_formatting**: Whether to keep the original formatting of the message.
|