-
Notifications
You must be signed in to change notification settings - Fork 0
/
plain_text.py
19 lines (15 loc) · 3.97 KB
/
plain_text.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PLAIN_TEXT_100_CHARS = """Transposition Cipher is a cryptographic algorithm where alphabets order in plain text is reordered.."""
PLAIN_TEXT_500_CHARS = """Ciphers are systems for encrypting and decrypting data. Ciphers are generally categorized according to how they work and by how their key is used for encryption and decryption. Block ciphers accumulate symbols in message of a fixed size, and stream ciphers work on continuous stream of symbols. When a cipher uses the same key for encryption and decryption, they are known as symmetric key algorithms or ciphers. Asymmetric key algorithms or ciphers use a different key for encryption or decryption.."""
PLAIN_TEXT_1000_CHARS = """Ciphers are systems for encrypting and decrypting data. Ciphers are generally categorized according to how they work and by how their key is used for encryption and decryption. Block ciphers accumulate symbols in message of a fixed size, and stream ciphers work on continuous stream of symbols. When a cipher uses the same key for encryption and decryption, they are known as symmetric key algorithms or ciphers. Asymmetric key algorithms or ciphers use a different key for encryption or decryption. While we were lucky to spot that flaw early, not all flaws are easy to spot. Those are the flaws that could lead to data breaches. Cryptography is a difficult science best suited for brilliant mathematicians. Before widely accepted encryption algorithms become widely accepted and released for public consumption, they undergo several stringent tests/reviews by various experts in the field. In fact, in spite of those tests, it's still possible to discover vulnerabilities in a cipher after release."""
PLAIN_TEXT_2000_CHARS = """In the cipher text only attack, the attacker only has access to one or more encrypted messages but knows nothing about the plaintext data, the encryption algorithm being used or any data about the cryptographic key being used. This is the type of challenge that intelligence agencies often face when they have intercepted encrypted communications from an opponent. In a known plaintext attack, the analyst may have access to some or all of the plaintext of the cipher text; the analyst's goal in this case is to discover the key used to encrypt the message and decrypt the message. Once the key is discovered, an attacker can decrypt all messages that had been encrypted using that key. Linear cryptanalysis is a type of known plaintext attack that uses a linear approximation to describe how a block cipher Known plaintext attacks depend on the attacker being able to discover or guess some or all of an encrypted message, or even the format of the original plain text. For example, if the attacker is aware that a particular message is addressed to or about a particular person, that person's name may be a suitable known plaintext. In a chosen plain text attack, the analyst either knows the encryption algorithm or has access to the device used to do the encryption. The analyst can encrypt the chosen plaintext with the targeted algorithm to derive information about the key. A differential cryptanalysis attack is a type of chosen plaintext attack on block ciphers that analyzes pairs of plain texts rather than single plaintexts, so the analyst can determine how the targeted algorithm works when it encounters different types of data. Integral cryptanalysis attacks are similar to differential cryptanalysis attacks, but instead of pairs of plain texts, it uses sets of plaintexts in which part of the plaintext is kept constant but the rest of the plaintext is modified. This attack can be especially useful when applied to block ciphers that are based on substitution-permutation networks. """
def get_plain_text(cipher_length: int) -> str:
if cipher_length == 100:
return PLAIN_TEXT_100_CHARS
elif cipher_length == 500:
return PLAIN_TEXT_500_CHARS
elif cipher_length == 1000:
return PLAIN_TEXT_1000_CHARS
elif cipher_length == 2000:
return PLAIN_TEXT_2000_CHARS
else:
return ""