Task7_5.py 619 B

1234567891011121314151617181920
  1. def verify(signature,private_key,fileName):
  2. data=getData(fileName)
  3. data=data.encode("utf-8")
  4. start=timer()
  5. public_key = private_key.public_key()
  6. public_key.verify(
  7. signature,
  8. data,
  9. hashes.SHA256()
  10. )
  11. end=timer()
  12. print("Time Taken to verify the signature is ",(end-start))
  13. print("Time Taken per byte to verify is ",((end-start)/len(data)))
  14. generateFiles()
  15. private_key=generatePrivateKey(2048)
  16. signature=sign(private_key,"kbfile.txt")
  17. verify(signature,private_key,"kbfile.txt")
  18. signature=sign(private_key,"mbfile.txt")
  19. verify(signature,private_key,"mbfile.txt")