Cyber Security Assignment ( Python)
Exercise 3: Python
Mark: 20%
Alice and Bob need to individually and separately generate the same encryption (secret) key to allow them
to securely exchange a message (read about Diffie-Hellman key exchange). To do this, in this case, they both
need two public numbers (? = 353 and ? = 3). Alice calculates an individual public key (?? = 40) and sends it
to Bob. Bob calculates an individual public key (?B = 248) and sends it to Alice. To generate the secret key
(K), Alice and Bob would need their individual private keys (?? and XB respectively) and the individual public
keys they received.
The relevant equations are:
?? = ∝
?? ??? ?
?? = ∝
?? ??? ?
?? = ??
?? ??? ? OR ?? = ??
?? ??? ?
Write a python script that will crack (brute force) the values of ?? and ?? and use them to generate the
secret key (?). You must comment your code and explain the steps. Deliverables include commented code
and screenshots showing the values (??, ?? and ?) generated by the code.
Hint: You already know the values of (? = 353, ? = 3, ?? = 40, and ?B = 248). ??? ? means ‘modulus ?‘
(check the mathematical notation for modulus). Your range is 1 to ? − 1, which means 1 – 352. You are
looking for the values of ?? and ?? such that ?? = ??.
____________________________________________________
Leave a Reply
Want to join the discussion?Feel free to contribute!