nim-eth-keys/tests/test_private_public_key_consistency.nim
Mamy Ratsimbazafy d3df9f5055
Libsecp256k1 backend (#2)
* Add safe hex, endianness and bytes conversion tools

* comment typo endianess -> endianness

* Add libsecp256k1 - private and public keygen and serialization + tests
2018-02-14 16:24:29 +01:00

16 lines
599 B
Nim

# Copyright (c) 2018 Status Research & Development GmbH
# Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
import ../src/eth_keys,
./config
import unittest
suite "Testing private -> public key conversion":
test "Known private to known public keys (test data from Ethereum eth-keys)":
for person in [alice, bob, eve]:
let privkey = initPrivateKey(person.privkey)
let computed_pubkey = privkey.public_key.serialize
check: computed_pubkey == "04" & person.pubkey # Serialization prefixes uncompressed public keys with 04