from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import ec from timeit import default_timer as timer import math # cryptography should be installed already. If not run the following: #> pip install cryptography private_key = ec.generate_private_key( ec.SECP192R1() ) data = b"Hello World!" start = timer() signature = private_key.sign( data, ec.ECDSA(hashes.SHA256()) ) duration = timer() - start print("Duration: %f" % duration) print("Size private_key: %d" % (math.ceil(private_key.key_size/8))) print("Size public_key: %d" % (math.ceil(private_key.public_key().key_size/8))) print("Size signature: %d" % len(signature))