Question
this is python can you answer as soon as possible this is a key to generate RSA Example 1: generating RSA public/private keys. numBits =
this is python
can you answer as soon as possible
this is a key to generate RSA
Example 1:
generating RSA public/private keys. numBits = 1024
keyPair = generateRSAKeys(numBits)
print("Public key: n={", hex(keyPair.n), "}, e={", hex(keyPair.e), "})")
print(' ')
print("Private key: n={", hex(keyPair.n), "}, d={", hex(keyPair.d), "})")
print(' ')
please answer
Create a RSA public/private key pair with 1024 bits key length [2 marks] o Hint: you can simply use the provided example (Example 1) in Sample program to generate a RSA key pair. o The RSA key pairs will be used in Task3 and Task4 of this assignment. o The created RSA public {n,e} and private keys {n,d} need to be displayed with the following format:
b)
2 Task2: Find a nonce which produces a hash value with hash algorithm SHA-256 satisfying requirement of the 8 least significant bits (LSB) being zero. [6 marks] o Hint: you can extend Example 4 in the provided sample program to complete this task. Example 4 generates only one nonce and check if the nonce is valid. o You should try many random integers as nonce (with a loop) until you successfully find a nonce that meets the requirement. The only output from this task is the nonce, which needs to be displayed with the following format (suppose the found nonce is 12345):
this is example 4 to help
# the nonce may be valid or may be invalid.
numZerosNeeded = 5
# generate a nonce (a random integer in a specified range)
nonce = random.randint(0,1000000)
validity = checkOneNonce(numZerosNeeded, nonce)
print('The validity of this nonce ', nonce, ' is:', validity)
print('================================================================ ')
Public key: (n=0x995361030caa5bf308e272fe07f346600727b5ac0c41107142fd97dd75ec4a197250c038 8b8711b210b2beb300980321913e 9eb21b22f72c3fe8b62addal 3491c6efbf3f4e6c6c60738 da c790af2ca0b806754550fae82c8ea85d3fc0667f1de7a193f23a1d30e8e7f2894f07ce26b5d94 85df5a29fc265fc217dbbb91065b35, e=0x10001) Private key: (n=0x995361030caa5bf308e272fe07f3466c0727b5ac0c41107142fd97dd75ec4a197250c038 858711b210b2beb300980321913e9eb21b22f72c3fe8b62adda13491c6efbf3f4e6c6c60738da c790af2ca0b8067f4550 fae82c8ea85d3fc0667f1de7a193f23a1d30e8e7f2894f07ce26b5d94 85df5a29fc265fc217dbbb91065b35, d=0x24cf1913a7d74042dce7ac6ea30efae19568299bb7c769009ff20ca2ec9c010011eb23f28 f40aa7562bfdebb4f91aef2c091557cflb9d7b82651a2663115flee0c416b1fec516a83657558 068fleebffae9f11b2801830acf2b0af4367fcd26ffe4672c5c5165afaeb5eeb81e6497a04192 1334 76e124b4ce2 a 869a16fc998el) Valid Nonce: 12345Step 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