mirror of
https://github.com/status-im/nim-eth-keys.git
synced 2025-02-13 01:36:38 +00:00
* Add jacobian primitives * Add ECDSA algos * Implement ECDSA, HMAC crypto (to be cleaned up) * [WIP] test suite * Fix arrayOfBytes <-> UInt256 casting issue * ecdsa_raw_sign: Fix shadowing result which lead to implicit object field construction requires a .partial object * Fix casting + remove tests covered by ranged type * Fix toHex conversion and add first test (failing) * Fix modular inversion for unsigned ints * Add modulo template * Public key generation bug still to hunt.
19 lines
529 B
Nim
19 lines
529 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, keccak_tiny
|
|
|
|
let
|
|
MSG = "message"
|
|
MSGHASH = keccak256(MSG)
|
|
|
|
suite "Test key and signature datastructures":
|
|
test "Signing fromprivate key object":
|
|
|
|
for person in [alice, bob, eve]:
|
|
let signature = person.privkey.sign_msg(MSG)
|
|
|
|
check: verify_msg_hash(person.privkey.public_key, MSGHASH, signature) |