pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/pyca/ed25519/pull/18/files

href="https://github.githubassets.com/assets/primer-primitives-16480f699a2fb35f.css" /> Add a simple profiling script by Ivoz · Pull Request #18 · pyca/ed25519 · GitHub
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import os
import sys
import cProfile

import ed25519

help_desc = """
profile.py [case] [loops]

Run profiling of ed25519 functions

case - must be one of: [default: val]
pub -- generating a public key
sig -- generating a signature
val -- validating a signature

loops - how many times to repeat test [default: 300]
"""

seed = os.urandom(32)
data = b"The quick brown fox jumps over the lazy dog" * 20
private_key = seed
public_key = ed25519.publickey(seed)
signature = ed25519.signature(data, private_key, public_key)

gen_public_key = 'ed25519.publickey(seed)'
gen_signature = 'ed25519.signature(data, private_key, public_key)'
do_validation = 'ed25519.checkvalid(signature, data, public_key)'

case = {
'pub': gen_public_key,
'sig': gen_signature,
'val': do_validation,
}

length = 300
choice = ''

if __name__ == "__main__":

if len(sys.argv) >= 2:
if sys.argv[1] == '-h' or sys.argv[1] == '--help':
print(help_desc)
exit()
choice = sys.argv[1]
if len(sys.argv) >= 3:
length = int(sys.argv[2])

method = case.get(choice, 'val')

loop = '[%s for _ in range(%d)]'

print('Running %s, %d times\n' % (case[method], length))

cProfile.run(loop % (case[method], length), sort='time')
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy