Giter Site home page Giter Site logo

pysecp256k1's People

Contributors

cag avatar czepluch avatar f483 avatar heikoheiko avatar konradkonrad avatar ulope avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

pysecp256k1's Issues

Port to Windows

I'm working on porting pyethapp to Windows. Can you help me with porting this package to Windows? Or help me finding a replacement?

performance test with random messages and keys

# very good results!
# (default) ~/dev/ethereum/pysecp256k1 (git)-[perftest] % python tests/test_secp256k1.py
# cffi took: 0.79secs / 79μs per op  / 12626 signs per sec
# cffi took: 1.28secs / 127μs per op  / 7821 recovers per sec

def rand32bytes():
    return ''.join(chr(random.randint(0, 255)) for i in range(32))


def perf(rounds=1000):
    privkeys = [rand32bytes() for i in range(rounds)]
    messages = [rand32bytes() for i in range(rounds)]
    # test sign
    signatures = []
    st = time.time()
    for priv, msg in zip(privkeys, messages):
        s = secp256k1_ecdsa_sign(msg, priv)
        signatures.append(s)
    elapsed = time.time() - st
    print 'cffi took: %.2fsecs / %dμs per op  / %d signs per sec' % \
        (elapsed, elapsed / rounds * 10**6, rounds / elapsed)

    # test recover
    pubs = []
    st = time.time()
    for sig, msg in zip(signatures, messages):
        p = secp256k1_ecdsa_recover(msg, sig)
        pubs.append(p)
    elapsed = time.time() - st
    print 'cffi took: %.2fsecs / %dμs per op  / %d recovers per sec' % \
        (elapsed, elapsed / rounds * 10**6, rounds / elapsed)

    # check
    for pub, privkey in zip(pubs, privkeys)[:100]:
        assert privtopub(privkey) == pub

if __name__ == '__main__':
    perf(10000)

add secp256k1 dependencies

// Dependencies for c_secp256k1
$ sudo apt-get install libssl-dev
$ sudo apt-get install libffi-dev
$ sudo apt-get install libtool

make clean after uncomplete install gives error

make clean
rm -fr build/
rm -fr dist/
rm -fr .egg-info
rm -fr c_secp256k1/
.so
rm -fr c_secp256k1/_c_secp256k1.py
rm -rf bitcoin-secp256k1-*
rm secp256k1.tar.gz
rm: secp256k1.tar.gz: No such file or directory
make: *** [clean-build] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.