bitcoinjs/bitcoinjs-lib — pull request #182 by dcousens (2014-05-16 14:55:06+00:00)
Title: EC Tests and use of Buffers

Depends on #181.

Firstly this pull request resolves a small bug/anomaly in `Transaction`, where the transaction type was required as input, when as per the protocol (and can be easily seen in the function above), the type is implicitly added to the end of the signature.
This first change amends that and slices the signature down to solely the DER signature.

Secondly it moves `ecdsa.deterministicGenerateK.HmacSHA256` to `crypto.HmacSHA256`, and puts it under test. Although it is implied that the `crypto-browserify` is already under test, its a cheap test and gives peace of mind if we decide to change the underlying crypto library later (doubtful).

The next two commits, 1794fc98ee563d72cb45e3b7dea9c3f1ec03615a and f7abad797b04149 both add extensive test vectors for the encoding/decoding aspects of the `ec` and `ecdsa` code.
Respectively for `ECPointFp.getEncoded`, `ECPointFp.decodeFrom`, `parseSig`, `parseSigCompact` and `serializeSig`. It also adds a new function `serializeSigCompact`, with tests respectively as well.

From there on, `serializeSigCompact` is swapped out with the inline implementation in `message`, and [`ECPointFp.getEncoded`, `ECPointFp.decodeFrom`, `parseSig`, `parseSigCompact`] were all transitioned to be compatible with `Buffer`'s.

`serializeSig` has not been updated yet due to several changes being required across the project. This will likely be in the next batch of commits...