From daab72765575394afe56db565af1cf5b17392c33 Mon Sep 17 00:00:00 2001 From: /raw PONG _GHMoaCXLT <58883403+q9f@users.noreply.github.com> Date: Mon, 6 Jan 2020 15:13:29 +0100 Subject: [PATCH 1/3] update docs --- docs/Secp256k1.html | 10 +++++----- docs/Secp256k1/Bitcoin.html | 26 +++++++++++++------------- docs/Secp256k1/Core.html | 10 +++++----- docs/Secp256k1/ECDSA_Signature.html | 12 ++++++------ docs/Secp256k1/EC_Point.html | 12 ++++++------ docs/Secp256k1/Ethereum.html | 10 +++++----- docs/Secp256k1/Hash.html | 26 +++++++++++++------------- docs/Secp256k1/Signature.html | 8 ++++---- docs/Secp256k1/Util.html | 20 ++++++++++---------- docs/index.html | 12 ++++++++++++ docs/index.json | 2 +- docs/search-index.js | 2 +- 12 files changed, 81 insertions(+), 69 deletions(-) diff --git a/docs/Secp256k1.html b/docs/Secp256k1.html index 8caa1a3..09fbec5 100644 --- a/docs/Secp256k1.html +++ b/docs/Secp256k1.html @@ -141,35 +141,35 @@
can be found here: https://q9f.github.io/secp256k1.cr/
generate a local copy with:
crystal docs
The base point G in compressed form is:
The base point G in uncompressed form is:
The commonly used base point G coordinates x, y; any other point that satisfies y^2 = x^3 + 7 would also do:
The curve E: y^2 = x^3 + ax + b over F_p is defined by a, b: As the a constant is zero, the ax term in the curve equation is always zero, hence the curve equation becomes y^2 = x^3 + 7.
Finally, the order n of G and the cofactor h are:
The elliptic curve domain parameters over F_p associated with a Koblitz curve Secp256k1 are specified by the sextuple T = (p, a, b, G, n, h) where the finite field F_p is defined by p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1:
expose the secp256k1 module
implements the bitcoin address space
generates a bitcoin address from a private key
generates a bitcoin address for any public key; compressed and uncompressed version 0x00 = btc mainnet; pass different versions for different networks
generates a bitcoin address from an public key ec point
gets a bitcoin address from a wif key
checks if it's compressed or uncompressed wallet import format
generates a new mini private key (30 characters, base-57)
gets a private key from a mini key
gets a private key from a wallet import format
gets the version byte from a wallet import format
to indicate a compressed key to be used, append a \"01\" byte
gets a base-58 wallet import format from private key
validates wether a wif has a correct checksum
Implements 256-bit Secp256k1 Koblitz elliptic curve reference https://www.secg.org/sec2-v2.pdf
elliptic curve jive addition of point p(x, y) and q(x, y).
elliptic curve juke point doubling of p(x, y).
elliptic curve modular multiplicative inverse of a
elliptic curve sequence multiplication of point p(x, y) and a skalar s, with s being a private key within the elliptic curve field size of EC_ORDER_N
A point in the two-dimensional space of an elliptic curve
the position on the x-axis
the position on the y-axis
an ecdsa signature
the x coordinate of a random point
the signature proof of a message
implements the Ethereum address space
returns a checksummed ethereum address as per eip-55
generates an ethereum address from a private key
generates an ethereum address for an uncompressed public key
generates an ethereum address from an public key ec point
the base-57 alphabet (for mini private keys)
the base-58 alphabet (for bitcoin)
wraps various hashing functions for convenience
get a character from the base-57 alphabet at position i
decode a hex string from base-58
encode a hex string as base-58
helper function to convert byte arrays to hex strings
helper function to convert hex strings to byte arrays
operating a keccak-256 hash on the byte array
operating a keccak-256 hash on the actual string literal
operating a ripemd-160 hash on the byte array
operating a sha2-256 hash on the byte array
operating a sha2-256 hash on the actual string literal
operating a sha3-256 hash on the byte array
operating a sha3-256 hash on the actual string literal
implements ecdsa signature generation and verification for secp256k1 ref: https://cryptobook.nakov.com/digital-signatures/ecdsa-sign-verify-messages
the ecdsa signing algorithm (rfc 6979) takes as input a message msg and a private key priv.
msg
priv
the algorithm to verify an ecdsa signature takes as input the signed message msg and the signature (r, s) produced from self.sign and the public key pub, corresponding to the signer's private key.
(r, s)
pub
same as self.verify, just using the hashed message directly
a collection of utilities for secp256k1 key management
decodes a public key as ec point from a compressed public key string
a helper to generate 32 pseudo-random bytes
exports the compressed public key from an ec point with prefix 02 or 03
wrapper function to perform an ec multiplication with the generator point and a provided private key
exports the uncompressed public key from an ec point without prefix
exports the uncompressed public key from an ec point with prefix 04
detects public key type and tries to restore the ec point from it
generic tool to encode single hex bytes as strings, e.g., \"07\"
utility tool to ensure hex keys are always 32 bytes it pads the number with leading zeros if not