-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolution.py
49 lines (44 loc) · 2.67 KB
/
solution.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
### welcome_assignment_answers
### Input - All eight questions given in the assignment.
### Output - The right answer for the specific question.
from ast import Num
from hashlib import md5
from lib2to3.pgen2.tokenize import tokenize
from tokenize import Number
def welcome_assignment_answers(question):
#Students do not have to follow the skeleton for this assignment.
#Another way to implement is using a "case" statements similar to C.
if question == "In Slack, what is the secret passphrase posted in the #lab-python-getting-started channel posted by a TA?":
answer = "mtls"
elif question == "Are encoding and encryption the same? - Yes/No":
answer = "No"
elif question == "Is it possible to decrypt a message without a key? - Yes/No":
answer = "No"
elif question == "Is it possible to decode a message without a key? - Yes/No":
answer = "Yes"
elif question == "Is a hashed message supposed to be un-hashed? - Yes/No":
answer = "No"
elif question == "What is the MD5 hashing value to the following message: 'NYU Computer Networking' - Use MD5 hash generator and use the answer in your code":
answer = md5("NYU Computer Networking".encode('utf-8')).hexdigest()
elif question == "Is MD5 a secured hashing algorithm? - Yes/No":
answer = "No"
elif question == "What layer from the TCP/IP model the protocol DHCP belongs to? - The answer should be a numeric number":
answer = int("5");
elif question == "What layer of the TCP/IP model the protocol TCP belongs to? - The answer should be a numeric number":
answer = int("4")
return(answer)
# Complete all the questions.
if __name__ == "__main__":
#use this space to debug and verify that the program works
debug_question = "What layer of the TCP/IP model the protocol TCP belongs to? - The answer should be a numeric number"
print(welcome_assignment_answers(debug_question))
###Questions:
###"In Slack, what is the secret passphrase posted in the #lab-python-getting-started channel posted by a TA?"
###"Are encoding and encryption the same? - Yes/No"
###"Is it possible to decrypt a message without a key? - Yes/No"
###"Is it possible to decode a message without a key? - Yes/No"
###"Is a hashed message supposed to be un-hashed? - Yes/No"
###"What is the MD5 hashing value to the following message: 'NYU Computer Networking' - Use MD5 hash generator and use the answer in your code"
###"Is MD5 a secured hashing algorithm? - Yes/No"
###"What layer from the TCP/IP model the protocol DHCP belongs to? - The answer should be a numeric number"
###"What layer of the TCP/IP model the protocol TCP belongs to? - The answer should be a numeric number"