@@ -47,21 +47,19 @@ func signatures_are_equal*(a, b: Signature): bool {.libPrefix: prefix_ffi.} =
47
47
proc sign * (sig: var Signature ,
48
48
secretKey: SecretKey ,
49
49
message: openArray [byte ],
50
- nonceSampler: NonceSampler = nsRandom,
51
- H: type CryptoHash = sha256) {.libPrefix : prefix_ffi, genCharAPI .} =
50
+ nonceSampler: NonceSampler = nsRandom) {.libPrefix : prefix_ffi, genCharAPI .} =
52
51
# # Sign `message` using `secretKey` and store the signature in `sig`. The nonce
53
52
# # will either be randomly sampled `nsRandom` or deterministically calculated according
54
53
# # to RFC6979 (`nsRfc6979`)
55
- sig.coreSign (secretKey.raw, message, H , nonceSampler)
54
+ sig.coreSign (secretKey.raw, message, keccak256 , nonceSampler)
56
55
57
56
proc verify * (
58
57
publicKey: PublicKey ,
59
58
message: openArray [byte ],
60
- signature: Signature ,
61
- H: type CryptoHash = sha256
59
+ signature: Signature
62
60
): bool {.libPrefix : prefix_ffi, genCharAPI .} =
63
61
# # Verify `signature` using `publicKey` for `message`.
64
- result = publicKey.raw.coreVerify (message, signature, H )
62
+ result = publicKey.raw.coreVerify (message, signature, keccak256 )
65
63
66
64
func derive_pubkey * (public_key: var PublicKey , secret_key: SecretKey ) {.libPrefix : prefix_ffi.} =
67
65
# # Derive the public key matching with a secret key
@@ -73,14 +71,13 @@ proc recoverPubkey*(
73
71
publicKey: var PublicKey ,
74
72
message: openArray [byte ],
75
73
signature: Signature ,
76
- evenY: bool ,
77
- H: type CryptoHash = sha256
74
+ evenY: bool
78
75
) {.libPrefix : prefix_ffi, genCharAPI .} =
79
76
# # Verify `signature` using `publicKey` for `message`.
80
77
# #
81
78
# # `evenY == true` returns the public key corresponding to the
82
79
# # even `y` coordinate of the `R` point.
83
- publicKey.raw.recoverPubkey (signature, message, evenY, H )
80
+ publicKey.raw.recoverPubkey (signature, message, evenY, keccak256 )
84
81
85
82
proc recoverPubkey * (
86
83
publicKey: var PublicKey ,
0 commit comments