1{ lib
2, fetchFromGitHub
3, buildPythonPackage
4, pythonOlder
5, pytest
6, pysha3
7, pycryptodome
8}:
9
10buildPythonPackage rec {
11 pname = "eth-hash";
12 version = "0.3.2";
13 disabled = pythonOlder "3.5";
14
15 src = fetchFromGitHub {
16 owner = "ethereum";
17 repo = "eth-hash";
18 rev = "v${version}";
19 sha256 = "sha256-LMDtFUrsPYgj/Fl9aBW1todlj1D3LlFxAkzNFAzCGLQ=";
20 };
21
22 checkInputs = [
23 pytest
24 ] ++ passthru.optional-dependencies.pycryptodome
25 ++ passthru.optional-dependencies.pysha3;
26
27 checkPhase = ''
28 pytest tests/backends/pycryptodome/
29 pytest tests/backends/pysha3/
30 '';
31
32 passthru.optional-dependencies = {
33 pycryptodome = [ pycryptodome ];
34 pysha3 = [ pysha3 ];
35 };
36
37 meta = with lib; {
38 description = "The Ethereum hashing function keccak256";
39 homepage = "https://github.com/ethereum/eth-hash";
40 license = licenses.mit;
41 maintainers = with maintainers; [ SuperSandro2000 ];
42 };
43}