Question

Please follow the directions when completing this. Add in comments so I can understand your work....

Please follow the directions when completing this. Add in comments so I can understand your work. Thank you.

Create your own cryptographic algorithm in Python that is unique and different (i.e. can be like XOR, but must have different values for the numbers like shift the letter 'a' over 3 letters so it equals 'd'). You must make capital letters different values than lowercase numbers. You must be able to encrypt by using this and decrypt this.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

inputMsg = input("Enter the message to be encrypted : ")

encryptedMsg = ''

decryptedMsg = ''

list1 = []

val = 0

i = len(inputMsg) - 1

while i >= 0:

val = ord(inputMsg[i]) - 10

list1.append(val)

encryptedMsg = encryptedMsg + chr(val)

i = i - 1

print("Encrypted message is : ", encryptedMsg)

list1.reverse()

for i in list1:

val = i + 10

decryptedMsg = decryptedMsg + chr(val)

i = i - 1

print("Decrypted message is : ", decryptedMsg)

Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
Enter the message to be encrypted : Hi, Mr.Jon. How are you? Contact me at 123456789
Encrypted message is : /.-,+*)('jW[cjYWjde95keo[hWme>$de@$hC"_>
Decrypted message is : Hi, Mr.Jon. How are you? Contact me at123456789

Add a comment
Know the answer?
Add Answer to:
Please follow the directions when completing this. Add in comments so I can understand your work....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in c++ The science of writing secret codes is called cryptography. For thousands of years cryptography...

    in c++ The science of writing secret codes is called cryptography. For thousands of years cryptography has made secret messages that only the sender and recipient could read, even if someone captured the messenger and read the coded message. A secret code system is called a cipher. In cryptography, we call the message that we want to be secret the plaintext. The plaintext could look like this:  Hello there! The keys to the house are hidden under the flower pot. Converting...

  • Please show work and describe how it is done so I will be able to follow...

    Please show work and describe how it is done so I will be able to follow along as best as possible, thank you! You are given a Binary Search Tree (BST) with nodes defined as follows: public class BSTNode<T extends Comparable<T>> { T data; BSTNode<T> left, right; a) Describe an algorithm to find the k-th smallest item in the BST. ( k=1 means smallest, k=2 means second smallest, etc.) Your description must be precise enough to be able to translate...

  • Need help with this C++ assignment, please use comments so I can better understand your code...

    Need help with this C++ assignment, please use comments so I can better understand your code like comments above your function header explaining what the function does and the purpose of each variable. etc. Assignment: Write a C++ program that reads a text file containing a list of movies "Movie_entries.txt" . Each line in the file contains tile, director, genre, year released and running time of a specific movie. Each field is separated by comma. Print out movie titles sorted...

  • Can someone provide detailed comments on what this code is doing for each line? I posted...

    Can someone provide detailed comments on what this code is doing for each line? I posted the assignment below. I am having trouble learning and getting assistance because I keep getting answers provided w/ good information on how the problem was solved. I have spent too much on tutoring this month and I am relying heavily on assistance here. Can you please assist with helping me understand each line of code that was written here? Also- is there an easier...

  • When solving these could you please do it in steps so I can understand and repeat...

    When solving these could you please do it in steps so I can understand and repeat it with different numbers! How many moles of an ideal gas must be present in a sample that is known to have a pressure of 18 atm, a volume of 2 liters, and a temperature of 41°C? a. 1.4 moles b. 3.91 moles c. 0.419 moles d. 3.21 moles If the gas is oxygen, what is the mass of this sample? How many molecules...

  • ****************************************************************************************************************8 I want it same as the output and with details please and comments "For two...

    ****************************************************************************************************************8 I want it same as the output and with details please and comments "For two thousand years, codemakers have fought to preserve secrets while codebreakers have tried their best to reveal them." - taken from Code Book, The Evolution of Secrecy from Mary, Queen of Scots to Quantum Cryptography by Simon Singh. The idea for this machine problem came from this book.You will encrypt and decrypt some messages using a simplified version of a code in the book. The...

  • Can you please complete it in java and add comments explaining the program so I can understand it...

    Can you please complete it in java and add comments explaining the program so I can understand it. Test cases: Test case 2 input PROBLEM: Evaluate a prefix expression. The operands in the expression are single digit whole numbers. The operators are binary addition (+), subtraction (), and multiplication(*), and a trinary operator "switcher" (a). The a operator of a, b, and c returns b when a is positive; otherwise, it returns Example 1: * + 4 53 1 simplifies...

  • please use c++ please write down the input file information please add comments for some codes...

    please use c++ please write down the input file information please add comments for some codes please do not use #include <bits/stdc++.h> we did not learn it yet thank you CSIT 575-Take Home Lab #11: Arrays To learn to code, compile and run a program processing characters. Assignment Plan and code a top-down modular program utilizing ARRAYS to solve the following problem, using at least 3 functions (called from the main() section or from another function) to solve the problem....

  • Java programming. Please, could you add the comment so I can follow and understand. Thanks Create...

    Java programming. Please, could you add the comment so I can follow and understand. Thanks Create a program with JavaFX that displays a bouncing graphics (an image of a ball or the head of Darth Vader or anything else). The object should bounce around in the window. There should also be a button in the win- dow that releases another object (unlimited number should be possible to have in the window, but only one new object should be released for...

  • PLEASE explain why and show work so I can try to follow and understand!! Thank you!!

    PLEASE explain why and show work so I can try to follow and understand!! Thank you!!

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT