コード例 #1
0
    def test_large_tree(self):
        tree = MerkleTree()
        for i in range(10000):
            tree.add_content(str(i))

        ans = 'a048d580177b80a60cbd31355400a0c9eabb5d2d3a4704fc9c86bae277f985c7'
        self.assertEqual(tree.merkle_root(), ans)
コード例 #2
0
    def test_large_tree(self):
        tree = MerkleTree()
        for i in range(10000):
            tree.add_content(str(i))

        ans = 'a048d580177b80a60cbd31355400a0c9eabb5d2d3a4704fc9c86bae277f985c7'
        self.assertEqual(tree.merkle_root(), ans)
コード例 #3
0
    def test_two_even_items(self):
        tree = MerkleTree()

        tree.add_content("test")
        tree.add_hash(tree.hash_f("test2"))

        ans = '694299f8eb01a328732fb21f4163fbfaa8f60d5662f04f52ad33bec63953ec7f'
        self.assertEqual(tree.merkle_root(), ans)
コード例 #4
0
    def test_two_even_items(self):
        tree = MerkleTree()

        tree.add_content("test")
        tree.add_hash(tree.hash_f("test2"))

        ans = '694299f8eb01a328732fb21f4163fbfaa8f60d5662f04f52ad33bec63953ec7f'
        self.assertEqual(tree.merkle_root(), ans)
コード例 #5
0
    def test_tree_odd_items(self):
        tree = MerkleTree()

        tree.add_content("test")
        tree.add_content("test2")
        tree.add_content("test3")

        ans = 'd49e815a91a26d399f8c2fba429e6ef7e472e54b6eb1e04341d207eee219f6c0'
        self.assertEqual(tree.merkle_root(), ans)
コード例 #6
0
    def test_tree_odd_items(self):
        tree = MerkleTree()

        tree.add_content("test")
        tree.add_content("test2")
        tree.add_content("test3")

        ans = 'd49e815a91a26d399f8c2fba429e6ef7e472e54b6eb1e04341d207eee219f6c0'
        self.assertEqual(tree.merkle_root(), ans)