nanoblocks.protocol.crypto.ed25519 package

Submodules

nanoblocks.protocol.crypto.ed25519.ed25519 module

Module contents

Modified version of ed22519 that uses pyblake2 hashes instead of sha512 Original at https://github.com/pyca/ed25519/blob/master/ed25519.py ed25519.py - Optimized version of the reference implementation of Ed25519 Written in 2011? by Daniel J. Bernstein <djb@cr.yp.to>

2013 by Donald Stufft <donald@stufft.io> 2013 by Alex Gaynor <alex.gaynor@gmail.com> 2013 by Greg Price <price@mit.edu>

To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. NB: This code is not safe for use with secret keys or secret data. The only safe use of this code is for verifying signatures on public messages. Functions for computing the public key of a secret key and for signing a message are included, namely publickey_unsafe and signature_unsafe, for testing purposes only. The root of the problem is that Python’s long-integer arithmetic is not designed for use in cryptography. Specifically, it may take more or less time to execute an operation depending on the values of the inputs, and its memory access patterns may also depend on the inputs. This opens it to timing and cache side-channel attacks which can disclose data to an attacker. We rely on Python’s long-integer arithmetic, so we cannot handle secrets without risking their disclosure.

nanoblocks.protocol.crypto.ed25519.H(m)
nanoblocks.protocol.crypto.ed25519.Hint(m, hasher=<function H>)
exception nanoblocks.protocol.crypto.ed25519.SignatureMismatch

Bases: Exception

nanoblocks.protocol.crypto.ed25519.bit(h, i)
nanoblocks.protocol.crypto.ed25519.checkvalid(s, m, pk)

Not safe to use when any argument is secret. See module docstring. This function should be used only for verifying public signatures of public messages.

nanoblocks.protocol.crypto.ed25519.decodeint(s)
nanoblocks.protocol.crypto.ed25519.decodepoint(s)
nanoblocks.protocol.crypto.ed25519.edwards_add(P, Q)
nanoblocks.protocol.crypto.ed25519.edwards_double(P)
nanoblocks.protocol.crypto.ed25519.encodeint(y)
nanoblocks.protocol.crypto.ed25519.encodepoint(P)
nanoblocks.protocol.crypto.ed25519.inv(z)

$= z^{-1} mod q$, for z != 0

nanoblocks.protocol.crypto.ed25519.isoncurve(P)
nanoblocks.protocol.crypto.ed25519.make_Bpow()
nanoblocks.protocol.crypto.ed25519.pow2(x, p)

== pow(x, 2**p, q)

nanoblocks.protocol.crypto.ed25519.publickey_unsafe(sk, hash_func=<function H>)

Not safe to use with secret keys or secret data. See module docstring. This function should be used for testing only.

nanoblocks.protocol.crypto.ed25519.scalarmult(P, e)
nanoblocks.protocol.crypto.ed25519.scalarmult_B(e)

Implements scalarmult(B, e) more efficiently.

nanoblocks.protocol.crypto.ed25519.signature_unsafe(m, sk, pk, hash_func=<function H>)

Not safe to use with secret keys or secret data. See module docstring. This function should be used for testing only.

nanoblocks.protocol.crypto.ed25519.xrecover(y)