- use elliptic.MarshalCompressed
- use elliptic.UnmarshalCompressed
- for older go versions use old methods
- update dependencies
- github.com/mr-tron/base58 v1.2.0
- github.com/pkg/errors v0.9.1
- github.com/stretchr/testify v1.7.0
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
SignECDSA function returns two coordinates on elliptic curve.
Catenation of these coordinates is a 64 byte signature. If
one of these coordinates have less than 32 significant bytes, then
it should have leading zeros.
Public keys can have X coordinate value shorter than 32 byte.
In this case `encodePoint()` should return 32 byte value with
leading zeros.
This commit also adds unit test for public key with 31 byte
X coordinate value.
It may be misleading when verify function takes signature as a hash
parameter. This commit suggested to use rfc6979 original naming
for the parameters:
- `msg` as the message to sign,
- `sig` as the signature of message.
All hashing operations are encapsulated inside of the Sign
and Verify functions.
Also there are comment fixes and re-usage of `hashBytes()` in rfc6979.