forked from svanas/delphereum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb3.eth.crypto.pas
47 lines (37 loc) · 1.47 KB
/
web3.eth.crypto.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{******************************************************************************}
{ }
{ Delphereum }
{ }
{ Copyright(c) 2018 Stefan van As <[email protected]> }
{ Github Repository <https://github.com/svanas/delphereum> }
{ }
{ Distributed under Creative Commons NonCommercial (aka CC BY-NC) license. }
{ }
{******************************************************************************}
unit web3.eth.crypto;
{$I web3.inc}
interface
uses
// CryptoLib4Pascal
ClpCryptoLibTypes,
ClpDigestUtilities,
ClpHMacDsaKCalculator,
// web3
web3.crypto;
type
TEthereumSigner = class(TECDsaSignerEx)
public
constructor Create;
function GenerateSignature(const msg: TCryptoLibByteArray): TECDsaSignature; reintroduce;
end;
implementation
{ TEthereumSigner }
constructor TEthereumSigner.Create;
begin
inherited Create(THMacDsaKCalculator.Create(TDigestUtilities.GetDigest('SHA-256')));
end;
function TEthereumSigner.GenerateSignature(const msg: TCryptoLibByteArray): TECDsaSignature;
begin
Result := inherited GenerateSignature(SECP256K1, msg);
end;
end.