Daniel Cousens
6f3d829be0
all: Expected T, got PARAM
2014-05-29 16:09:47 +10:00
Daniel Cousens
2f44628604
Transaction: refactor hashForSignature
...
Adds asserts to ensure only valid hashes are created (until the
implementation is complete).
Also uses `Script.without` to remove OP_CODESEPARATOR from the Scripts
as required by the protocol.
2014-05-29 16:06:19 +10:00
Daniel Cousens
7d94d1b068
Script: add fromChunks and without
2014-05-29 16:06:19 +10:00
Daniel Cousens
d18f2dba00
bufferutils: add PUSHDATA implementation
2014-05-29 16:06:19 +10:00
Daniel Cousens
54950c9abb
Transaction: fix SIGHASH_* constant values
2014-05-29 16:06:19 +10:00
Daniel Cousens
db814439a3
Transaction: extract DEFAULT_SEQUENCE constant
...
Also fixes the bug when the sequence number is 0 and
`TransactionIn.defaultSequence` is used; resulting in an undefined
sequence number as it is undefined.
2014-05-29 16:06:19 +10:00
Daniel Cousens
7494a146a6
ECKey: fix exception tests
...
These weren't broken as such, but they weren't distinctly checking that
the right exception was thrown either.
2014-05-29 16:01:04 +10:00
Daniel Cousens
6cfa729dae
ecdsa: fix missing exceptions
2014-05-29 15:42:52 +10:00
Daniel Cousens
2fc69b0834
address/base58check: fix missing exceptions/tests
...
All the `invalid2` tests have been removed as they were not invalid
base58check. They were actually valid in some cases.
They will be re-integrated in more specific bitcoin core tests in
relation to Address/ECKey respectively.
2014-05-29 14:43:44 +10:00
Daniel Cousens
47ae862ae9
base58: fix missing exceptions
2014-05-29 14:43:29 +10:00
John Russell
343289229e
ensures that pubKey length is greater than m
...
ensure that pubKey length is greater than m
use Array.isArray over instanceof
error message
2014-05-28 01:48:17 -07:00
Daniel Cousens
8514bbfabd
Address: remove Address.Error
...
By removing Address.Error, we remove a code smell.
This part of the code base was also not under any form of test.
Test data and tests have therefore been added verifying its behaviour in
both Wallet and Address tests.
2014-05-28 13:17:07 +10:00
Kyle Drake
33e5883be1
sec: remove untested alt curves not used by bitcoin
2014-05-25 14:30:34 +10:00
Kyle Drake
600209b1a6
hdwallet: remove fromHex, add better tests for edge cases
2014-05-25 12:26:29 +10:00
Kyle Drake
dd3e171212
Merge pull request #188 from dcousens/ecsig
...
ecdsa: always use signature object
2014-05-25 11:57:09 +10:00
Daniel Cousens
08951be66f
Script: add createPubKeyScriptPubKey
2014-05-25 10:21:06 +10:00
Kyle Drake
f545ed1279
remove crypto hash transition code
2014-05-25 09:46:06 +10:00
Daniel Cousens
c17c6f9291
Merge pull request #192 from coinpunk/eccleanup
...
Cleanup some unused ec.js code
2014-05-24 20:09:48 +10:00
Daniel Cousens
58fd12e66d
ecdsa: always use signature object
2014-05-24 16:25:38 +10:00
Daniel Cousens
bd1a08bfa1
ecdsa: use signum() over compareTo
2014-05-24 14:33:25 +10:00
Kyle Drake
bc062fbdce
cleanup some unused ec.js code
2014-05-24 13:33:23 +10:00
Daniel Cousens
aca565239a
ECKey: remove unnecessary slice
2014-05-24 00:51:56 +10:00
Daniel Cousens
cd326921bc
bigi: upgrade to 1.1.0
2014-05-24 00:51:56 +10:00
Daniel Cousens
1087ac07de
sec: fix formatting
2014-05-24 00:51:56 +10:00
Daniel Cousens
b8858c0bc9
sec: use BigInteger.fromHex directly
2014-05-24 00:51:56 +10:00
Daniel Cousens
da48c988f6
sec: use a hashtable for lookup
2014-05-24 00:51:56 +10:00
Daniel Cousens
087ca551f5
ecdsa: fix indentation
2014-05-24 00:48:31 +10:00
Daniel Cousens
d05d661aea
ecdsa: use standard declarative notation for functions
2014-05-24 00:48:31 +10:00
Daniel Cousens
bcfd62fdb5
ecdsa: remove implicit ecparams
2014-05-24 00:48:31 +10:00
Daniel Cousens
2dec1375a1
ecdsa: use (r, s) values directly
2014-05-24 00:48:31 +10:00
Daniel Cousens
8d7408202f
ecdsa: consistent parameter ordering
2014-05-24 00:48:31 +10:00
Daniel Cousens
abe65b8d4a
ecdsa: use shamirs trick
2014-05-24 00:48:20 +10:00
Daniel Cousens
a17a5b23d9
ec: fix point decoding for other curves
2014-05-22 12:33:47 +10:00
Daniel Cousens
5ec9504ed6
ecdsa: opt for shiftRight, pow and square
...
In the given situations, these offer better readability, or in the case
of shiftRight, a substantial performance increase.
2014-05-22 12:33:47 +10:00
Daniel Cousens
7d89ff427c
ecdsa: comment cleanup
2014-05-22 12:33:47 +10:00
Daniel Cousens
0865f09d20
ec/dsa: extract P_OVER_FOUR as a curve specific constant
...
This actually resolves a possible bug if multiple ecparams were used
(aka different values for P_OVER_FOUR, but only the cached was used).
2014-05-22 12:33:47 +10:00
Daniel Cousens
1e54c521d5
ec: extract BigInteger constants
2014-05-22 12:33:47 +10:00
Daniel Cousens
d9ce4bee6b
ec: use signum() not equals(BigInteger.ZERO)
2014-05-22 12:33:47 +10:00
Daniel Cousens
d14b08efd1
ec/dsa: recovery param now used consistently
...
Also added an assertion rather than massaging the input.
2014-05-22 12:32:28 +10:00
Daniel Cousens
24371425f9
ec: decodeFrom now uses Buffers and handles errors
2014-05-18 17:52:49 +10:00
Daniel Cousens
a3f691bf7c
ecdsa: parseSigCompact use Buffer API
...
parseSigCompact also now returns the correct recovert parameter without
the need to subtract the compression bit.
This makes it easier to use.
2014-05-18 17:52:49 +10:00
Daniel Cousens
f7c7265d64
ecdsa: parseSig now uses buffer API
2014-05-18 17:52:49 +10:00
Daniel Cousens
ccca6989b5
ec: getEncoded now uses Buffer API
2014-05-18 17:52:49 +10:00
Daniel Cousens
db3ffe58d1
message: use serializeSigCompact
2014-05-18 17:52:49 +10:00
Daniel Cousens
4c7108d561
ecdsa: add serializeSigCompact and tests
...
This also adds tests for all other ECDSA serialize/parsing functions.
The k, r, s and D values were sourced from test vectors on
https://bitcointalk.org/index.php?topic=285142.40 .
The compact signatures (aka, i values) were generated from bitcoinjslib, but they
are straight forward anyway.
2014-05-18 17:52:49 +10:00
Daniel Cousens
b208a6ab78
crypto/ecdsa: moves HmacSHA256 to crypto
2014-05-18 17:52:49 +10:00
Daniel Cousens
99a1b7274c
Transaction: use the type embedded in the signature
2014-05-18 17:52:48 +10:00
Daniel Cousens
6b5990c6e2
message: support alternate networks
2014-05-18 17:51:36 +10:00
Daniel Cousens
10fe4474d1
ECKey: remove *Buffer/*Hex functions
...
An ECKey is a composition of a private key (D), a public key (Q) and its
compression flag.
These functions gave the impression of serialization of this
composition, when really they only serialized `D`.
They have therefore been removed in favour of always using a sane
serialization format (WIF) that matches the needed behaviour.
If a user needs the previous functionality, simply use `privKey.D.*`
instead of `privKey.*`, as BigInteger supports `*Buffer/*Hex` functions
as expected.
2014-05-18 17:50:10 +10:00
Daniel Cousens
0468c4710c
Transaction: rename (de)serialize to [to/from]Buffer
2014-05-17 00:09:13 +10:00