Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 771e9f59d639dbb0e2fa8e646c8e588405d3903e authored by Hubert Kario on 09 September 2021, 19:24:48 UTC, committed by GitHub on 09 September 2021, 19:24:48 UTC
Merge pull request #474 from tlsfuzzer/ubuntu18.04
use newer ubuntu for old pythons
2 parent s 7b7a811 + b3e9049
  • Files
  • Changes
  • 3477098
  • /
  • scripts
  • /
  • speed.py
Raw File
Cook and download a directory from the Software Heritage Vault

You have requested the cooking of the directory with identifier None into a standard tar.gz archive.

Are you sure you want to continue ?

Download a directory from the Software Heritage Vault

You have requested the download of the directory with identifier None as a standard tar.gz archive.

Are you sure you want to continue ?

Cook and download a revision from the Software Heritage Vault

You have requested the cooking of the history heading to revision with identifier swh:1:rev:771e9f59d639dbb0e2fa8e646c8e588405d3903e into a bare git archive.

Are you sure you want to continue ?

Download a revision from the Software Heritage Vault

You have requested the download of the history heading to revision with identifier swh:1:rev:771e9f59d639dbb0e2fa8e646c8e588405d3903e as a bare git archive.

Are you sure you want to continue ?

Invalid Email !

The provided email is not well-formed.

Download link has expired

The requested archive is no longer available for download from the Software Heritage Vault.

Do you want to cook it again ?

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • content
revision badge
swh:1:rev:771e9f59d639dbb0e2fa8e646c8e588405d3903e
content badge Iframe embedding
swh:1:cnt:a240ae906fc0c945c9975e618b803e0b9adbad2f
speed.py
import timeit

from tlslite.utils.cryptomath import gmpyLoaded, GMPY2_LOADED

print("Acceleration backends loaded:")
print("gmpy: {0}".format(gmpyLoaded))
print("gmpy2: {0}".format(GMPY2_LOADED))
print("")

def do(setup_statements, statement):
    # extracted from timeit.py
    t = timeit.Timer(stmt=statement, setup="\n".join(setup_statements))
    # determine number so that 0.2 <= total time < 2.0
    for i in range(1, 10):
        number = 10 ** i
        x = t.timeit(number)
        if x >= 0.2:
            break
    return x / number


prnt_form = (
    "{name:>16}{sep:1} {keygen:>9{form}}{unit:1} "
    "{keygen_inv:>9{form_inv}} {sign:>9{form}}{unit:1} "
    "{sign_inv:>9{form_inv}} {verify:>9{form}}{unit:1} "
    "{verify_inv:>9{form_inv}}"
)

print(
    prnt_form.format(
        keygen="keygen",
        keygen_inv="keygen/s",
        sign="sign",
        sign_inv="sign/s",
        verify="verify",
        verify_inv="verify/s",
        name="",
        sep="",
        unit="",
        form="",
        form_inv="",
    )
)

for size in [1024, 2048, 3072, 4096]:
    S1 = "from tlslite.utils.python_rsakey import Python_RSAKey"
    S2 = "from tlslite.utils.cryptomath import secureHash"
    S3 = "key = Python_RSAKey.generate(%s)" % size
    S4 = "msg = b'msg'"
    S5 = "msg_hash = secureHash(msg, 'sha1')"
    S6 = "sig = key.sign(msg_hash)"
    S7 = "key.verify(sig, msg_hash)"
    keygen = do([S1, S2], S3)
    sign = do([S1, S2, S3, S4, S5], S6)
    verf = do([S1, S2, S3, S4, S5, S6], S7)

    print(
        prnt_form.format(
            name="RSA {0} bits".format(size),
            sep=":",
            unit="s",
            keygen=keygen,
            keygen_inv=1.0 / keygen,
            sign=sign,
            sign_inv=1.0 / sign,
            verify=verf,
            verify_inv=1.0 / verf,
            form=".5f",
            form_inv=".2f",
        )
    )

print("")

The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top