Size: 1737
Comment:
|
Size: 4143
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
This page was be created at Sage Days 103 , 7-10 August 2019 by Sarah Arpin, Catalina Camacho-Navarro, Holly Paige Chaos, Amy Feaver, Eva Goedhart, Rebecca Lauren Miller, Alexis Newton, and Nandita Sahajpal. | This page was be created at Sage Days 103, 7-10 August 2019 by Sarah Arpin, Catalina Camacho-Navarro, Holly Paige Chaos, Amy Feaver, Eva Goedhart, Rebecca Lauren Miller, Alexis Newton, and Nandita Sahajpal. |
Line 18: | Line 18: |
A classical cryptosystem that takes your text and shifts it through the alphabet by a given number of letters. -EG | A classical cryptosystem that takes your plaintext and shifts it through the alphabet by a given number of letters. -EG === Shift Cipher Encryption === |
Line 21: | Line 23: |
print "Put your message in quotes, and your desired shift: " | #Last edited 8/7/19 2:45pm print "Put your message in between the provided quotes (with no additional quotes or apostrophes!), and select your desired shift: " |
Line 23: | Line 26: |
def shift_cipher(message = input_box(default="'secrets hi'", width = 50), shift=slider(0,25,1,3)): |
def shift_cipher(message = input_box(default='"secrets"', width = 50), shift=slider(0,25,1,3)): |
Line 29: | Line 31: |
print "Enciphered message:" | print "This is your encrypted text shifted by ",shift,":" |
Line 31: | Line 33: |
}}} === Shift Cipher Decryption === If you know that your encrypted message is a shift cipher, you can use the known encryption to decrypt. If this is not known, brute force can be used to get possible decrypted messages. {{{#!sagecell #Last edited 8/7/19 2:56pm print "Enter the encrypted text in quotes, and enter a guess for the shift amount:" @interact def shift_decrypt(text = input_box('"KL"'), shift_by = input_box(0)): S = ShiftCryptosystem(AlphabeticStrings()) ciphertext = S.encoding(text) decrypt = S.deciphering(shift_by,ciphertext) print "If the shift was by", shift_by,", then the original message was:" print decrypt decrypt = S.brute_force(ciphertext) print "These are the possibilities for the plaintext:" print decrypt decrypt = S.brute_force(ciphertext,ranking = "chisquare") print "These are the possibilities ranked by likelihood with the chi-squared function:" print decrypt |
|
Line 51: | Line 76: |
by Holly Paige Chaos and Rebecca Lauren Miller | by Holly Paige Chaos, Rebecca Lauren Miller, and Kate Stange |
Line 53: | Line 78: |
Using a secret key word, encrypt each letter by shifting it the corresponding letter in the key word. -EG | Using a secret code word, encrypt each letter by shifting it the corresponding letter in the code word. -EG === Vigenère Cipher Encryption === |
Line 56: | Line 83: |
#This encrypts your message: Final 8/7/19. Written by Rebecca Lauren Miller, Holly Paige Chaos, Kate Strange. print "Put your message and codeword in quotes: " @interact def vigenere_cipher(message = input_box(default ="'secrets hi'", width = 50), code_word = input_box(default="'cat'", width = 50)): A = AlphabeticStrings() message2 = A.encoding(message) code_word2 = A.encoding(code_word) system = VigenereCryptosystem(A,len(code_word2)) ciphertext = system.enciphering(code_word2,message2) print "Enciphered message:" print ciphertext }}} |
|
Line 57: | Line 96: |
=== Vigenère Cipher Decryption === {{{#!sagecell #This decrypts your message: Final 8/7/19. Written by Rebecca Lauren Miller, Holly Paige Chaos, Kate Strange. print "Put your message and codeword in quotes: " @interact def vigenere_cipher(message = input_box(default ="'UEVTEMUHB'", width = 50), code_word = input_box(default="'cat'", width = 50)): A = AlphabeticStrings() message2 = A.encoding(message) code_word2 = A.encoding(code_word) system = VigenereCryptosystem(A,len(code_word2)) ciphertext = system.deciphering(code_word2,message2) print "Deciphered message:" print ciphertext |
Sage Interactions - Cryptography - Under Construction
This page was be created at Sage Days 103, 7-10 August 2019 by Sarah Arpin, Catalina Camacho-Navarro, Holly Paige Chaos, Amy Feaver, Eva Goedhart, Rebecca Lauren Miller, Alexis Newton, and Nandita Sahajpal.
If you have cryptography related interactions that you are interested in adding to this page, please do so. You can also contact Amy Feaver at [email protected] if you have interactions that you are interested in having us add to the page during Sage Days. We will consider them and add them in if we can!
goto interact main page
Contents
Shift Cipher
by Sarah Arpin, Alexis Newton
A classical cryptosystem that takes your plaintext and shifts it through the alphabet by a given number of letters. -EG
Shift Cipher Encryption
Shift Cipher Decryption
If you know that your encrypted message is a shift cipher, you can use the known encryption to decrypt. If this is not known, brute force can be used to get possible decrypted messages.
Affine Cipher
by Sarah Arpin, Alexis Newton
Substitution Cipher
by Catalina Camacho-Navarro
A simple cipher to encrypt messages in which each letter is assigned to another letter. Brute force or frequency analysis can be used to decrypt. -EG
Vigenère Cipher
by Holly Paige Chaos, Rebecca Lauren Miller, and Kate Stange
Using a secret code word, encrypt each letter by shifting it the corresponding letter in the code word. -EG
Vigenère Cipher Encryption
Vigenère Cipher Decryption