Question
Please use Python to help Decode the message in deliverable #6. I have provided the naivefactors and the keyset functions below. C = [7473306,34860190,31360573,20968028,9070305,20827012,34743153,11419633,36622909,20827012,34743153,7882764,34860190,31360573,21566064,7163950,34860190,31360573,7163950,13366249,34860190,11419633,9070305,7163950,20827012,19210583,29100039,7882764,131312,12921995,131312,21521610,131312,31360573,34743153,4735271,7163950,9665260,7882764,34743153,29100039,7163950,131312,12921995,131312,9070305,13366249,7163950,20827012,19210583,19210583,34860190,21521610,10677701,36622909,7882764,21566064,29100039,21521610,131312,31360573,34743153,7467220,7163950,34743153,29100039,131312,9070305,131312,7163950,7882764,21566064,7163950,20827012,31360573,7163950,131312,31360573,18965078,4735271,7163950,9665260,7882764,34743153,29100039,7163950,131312,12921995,131312,9070305,13366249,7163950,131312,31360573,18965078,7163950,34743153,29100039,131312,9070305,131312,7163950,7882764,21566064,7163950,20827012,36622909,15592578,20827012,13366249,21566064,7163950,20827012,7163950,31360573,131312,15592578,7163950,8995063,131312,20968028,7882764,31360573,31360573,7882764,31360573,20968028,4735271,7163950,32047640,7882764,33864881,131312,7163950,19210583,34860190,31360573,34743153,7882764,31360573,11419633,20827012,36622909,36622909,13366249,7163950,21521610,34860190,12921995,131312,21566064,7163950,33864881,9070305,34860190,21521610,7163950,20827012,7163950,8995063,131312,20968028,7882764,31360573,31360573,7882764,31360573,20968028,4735271,4735271,4735271,7163950,34743153,34860190,7163950,20827012,31360573,7163950,131312,31360573,18965078,4735271,4735271,4735271,34743153,34860190,7163950,20827012,7163950,31360573,131312,15592578,7163950,8995063,131312,20968028,7882764,31360573,31360573,7882764,31360573,20968028,4735271] Keyset
Please use Python to help Decode the message in deliverable #6. I have provided the naivefactors and the keyset functions below.
C = [7473306,34860190,31360573,20968028,9070305,20827012,34743153,11419633,36622909,20827012,34743153,7882764,34860190,31360573,21566064,7163950,34860190,31360573,7163950,13366249,34860190,11419633,9070305,7163950,20827012,19210583,29100039,7882764,131312,12921995,131312,21521610,131312,31360573,34743153,4735271,7163950,9665260,7882764,34743153,29100039,7163950,131312,12921995,131312,9070305,13366249,7163950,20827012,19210583,19210583,34860190,21521610,10677701,36622909,7882764,21566064,29100039,21521610,131312,31360573,34743153,7467220,7163950,34743153,29100039,131312,9070305,131312,7163950,7882764,21566064,7163950,20827012,31360573,7163950,131312,31360573,18965078,4735271,7163950,9665260,7882764,34743153,29100039,7163950,131312,12921995,131312,9070305,13366249,7163950,131312,31360573,18965078,7163950,34743153,29100039,131312,9070305,131312,7163950,7882764,21566064,7163950,20827012,36622909,15592578,20827012,13366249,21566064,7163950,20827012,7163950,31360573,131312,15592578,7163950,8995063,131312,20968028,7882764,31360573,31360573,7882764,31360573,20968028,4735271,7163950,32047640,7882764,33864881,131312,7163950,19210583,34860190,31360573,34743153,7882764,31360573,11419633,20827012,36622909,36622909,13366249,7163950,21521610,34860190,12921995,131312,21566064,7163950,33864881,9070305,34860190,21521610,7163950,20827012,7163950,8995063,131312,20968028,7882764,31360573,31360573,7882764,31360573,20968028,4735271,4735271,4735271,7163950,34743153,34860190,7163950,20827012,31360573,7163950,131312,31360573,18965078,4735271,4735271,4735271,34743153,34860190,7163950,20827012,7163950,31360573,131312,15592578,7163950,8995063,131312,20968028,7882764,31360573,31360573,7882764,31360573,20968028,4735271]
Keyset Function:
Naive Factoring function:
find D function and egcd function:
[n, e] = [39217303, 7687] C = [7473306,34860190,31360573,20968028,9070305,20827012,34743153, 11419633,36622909,20827012,34743153,7882764,34860190, Deliverable #6: Uncover the secret message Your mission: 1. Use your naivefactors function to determine p and q, 2. Use your keyset function to generate Alice's complete key set, 3. Use Alice's key set to decrypt Bob's message. # TODO: complete the mission and uncover the secret message 1. def keyset(p,q,e): 2 n = p *a 3 d = find_d(ne) return[n,e,d] 4 1 from math import sqrt 2 3. def naivefactors(n): 4 | 5. for i in range(2, int(sqrt(n))): 6. if (n % i == 0): return [i, int(n / i)] 7 1 import math 2 3. def egcd(a,b): 4 5 6 7 if a==0: return [1,1,0,0] 8 listofvalues=[] s1=1 S2=0 t1=0 t2=1 r1=a r2=b 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 while True: v=r1//r2 listofvalues.append(q) r1 r2=r2,r1-(v*r2) 51,52=52,51-(v*52) t1, t2=t2, t1-(v*t2) if r2==0: return [r1,51, t1, listofvalues[ -2]] 30 31 32 def find_d(k,e): return egcd(k, e)[27] [n, e] = [39217303, 7687] C = [7473306,34860190,31360573,20968028,9070305,20827012,34743153, 11419633,36622909,20827012,34743153,7882764,34860190, Deliverable #6: Uncover the secret message Your mission: 1. Use your naivefactors function to determine p and q, 2. Use your keyset function to generate Alice's complete key set, 3. Use Alice's key set to decrypt Bob's message. # TODO: complete the mission and uncover the secret message 1. def keyset(p,q,e): 2 n = p *a 3 d = find_d(ne) return[n,e,d] 4 1 from math import sqrt 2 3. def naivefactors(n): 4 | 5. for i in range(2, int(sqrt(n))): 6. if (n % i == 0): return [i, int(n / i)] 7 1 import math 2 3. def egcd(a,b): 4 5 6 7 if a==0: return [1,1,0,0] 8 listofvalues=[] s1=1 S2=0 t1=0 t2=1 r1=a r2=b 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 while True: v=r1//r2 listofvalues.append(q) r1 r2=r2,r1-(v*r2) 51,52=52,51-(v*52) t1, t2=t2, t1-(v*t2) if r2==0: return [r1,51, t1, listofvalues[ -2]] 30 31 32 def find_d(k,e): return egcd(k, e)[27]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started