2019-08-01 11:06:32 +00:00
|
|
|
import hashlib
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def leaf():
|
2019-08-01 15:21:28 +00:00
|
|
|
def _leaf(node, roots=None):
|
2019-10-06 14:11:49 +00:00
|
|
|
return hashlib.sha256(node.data).digest()
|
2019-08-01 11:06:32 +00:00
|
|
|
|
|
|
|
return _leaf
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def parent():
|
2019-08-01 15:21:28 +00:00
|
|
|
def _parent(first, second):
|
2019-08-01 11:06:32 +00:00
|
|
|
sha256 = hashlib.sha256()
|
2019-08-01 15:21:28 +00:00
|
|
|
sha256.update(first.data)
|
|
|
|
sha256.update(second.data)
|
2019-10-06 14:11:49 +00:00
|
|
|
return sha256.digest()
|
2019-08-01 11:06:32 +00:00
|
|
|
|
|
|
|
return _parent
|