nitowa 1dae68b1c7 init | 1 년 전 | |
---|---|---|
.. | ||
build | 1 년 전 | |
native | 1 년 전 | |
node_modules/bn.js | 1 년 전 | |
scripts | 1 년 전 | |
.gitmodules | 1 년 전 | |
.travis.yml | 1 년 전 | |
LICENSE | 1 년 전 | |
README.md | 1 년 전 | |
binding.gyp | 1 년 전 | |
index.js | 1 년 전 | |
js.js | 1 년 전 | |
native.js | 1 년 전 | |
package.json | 1 년 전 | |
rfc6979.js | 1 년 전 |
This library is under development, and, like the secp256k1 C library it depends on, this is a research effort to determine an optimal API for end-users of the bitcoinjs ecosystem.
npm install tiny-secp256k1
yarn add tiny-secp256k1
If you are having problems, please read the guide at secp256k1-node, as the build instructions should be exactly the same (and this module is a direct derivation).
isPoint :: Buffer -> Bool
Returns false
if
A
is not encoded with a sequence tag of 0x02
, 0x03
or 0x04
A.x
is not in [1...p - 1]
A.y
is not in [1...p - 1]
isPointCompressed :: Buffer -> Bool
Returns false
if the signature is not compressed.
isPrivate :: Buffer -> Bool
Returns false
if
d
is not 256-bit, ord
is not in [1..order - 1]
pointAdd :: Buffer -> Buffer [-> Bool] -> Maybe Buffer
Returns null
if result is at infinity.
Expected Point
if !isPoint(A)
Expected Point
if !isPoint(B)
pointAddScalar :: Buffer -> Buffer [-> Bool] -> Maybe Buffer
Returns null
if result is at infinity.
Expected Point
if !isPoint(A)
Expected Tweak
if tweak
is not in [0...order - 1]
pointCompress :: Buffer -> Bool -> Buffer
Expected Point
if !isPoint(A)
pointFromScalar :: Buffer [-> Bool] -> Maybe Buffer
Returns null
if result is at infinity.
Expected Private
if !isPrivate(d)
pointMultiply :: Buffer -> Buffer [-> Bool] -> Maybe Buffer
Returns null
if result is at infinity.
Expected Point
if !isPoint(A)
Expected Tweak
if tweak
is not in [0...order - 1]
privateAdd :: Buffer -> Buffer -> Maybe Buffer
Returns null
if result is equal to 0
.
Expected Private
if !isPrivate(d)
Expected Tweak
if tweak
is not in [0...order - 1]
privateSub :: Buffer -> Buffer -> Maybe Buffer
Returns null
if result is equal to 0
.
Expected Private
if !isPrivate(d)
Expected Tweak
if tweak
is not in [0...order - 1]
sign :: Buffer -> Buffer -> Buffer
Returns normalized signatures, each of (r, s) values are guaranteed to less than order / 2
.
Uses RFC6979.
Expected Private
if !isPrivate(d)
Expected Scalar
if h
is not 256-bitsign :: Buffer -> Buffer -> Buffer -> Buffer
Returns normalized signatures, each of (r, s) values are guaranteed to less than order / 2
.
Uses RFC6979.
Adds e
as Added Entropy to the deterministic k generation.
Expected Private
if !isPrivate(d)
Expected Scalar
if h
is not 256-bitExpected Extra Data (32 bytes)
if e
is not 256-bitverify :: Buffer -> Buffer -> Buffer -> Bool
Returns false
if any of (r, s) values are equal to 0
, or if the signature is rejected.
If strict
is true
, valid signatures with any of (r, s) values greater than order / 2
are rejected.
Expected Point
if !isPoint(Q)
Expected Signature
if signature
has any (r, s) values not in range [0...order - 1]
Expected Scalar
if h
is not 256-bitThis is a partially derived work of https://github.com/cryptocoinjs/secp256k1-node, specifically this commit.
This library uses the native library secp256k1 by the bitcoin-core developers, including derivatives of its tests and test vectors.