This repository was archived by the owner on May 19, 2026. It is now read-only.
forked from dashdot/python-x11_hash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·55 lines (47 loc) · 1.83 KB
/
Copy pathtest.py
File metadata and controls
executable file
·55 lines (47 loc) · 1.83 KB
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
48
49
50
51
52
53
54
55
import keccak_hash
from binascii import unhexlify, hexlify
import unittest
import sys
# smartcash block #1
# rc125@ubuntu:~/.smartcash$ smartcashd getblockhash 1
# 00000009c4e61bee0e8d6236f847bb1dd23f4c61ca5240b74852184c9bf98c30
# rc125@ubuntu:~/.smartcash$ smartcashd getblock 00000009c4e61bee0e8d6236f847bb1dd23f4c61ca5240b74852184c9bf98c30
# {
# "hash": "00000009c4e61bee0e8d6236f847bb1dd23f4c61ca5240b74852184c9bf98c30",
# "confirmations": 172736,
# "strippedsize": 356,
# "size": 356,
# "weight": 1424,
# "height": 1,
# "version": 2,
# "versionHex": "00000002",
# "merkleroot": "a68bf0e348915b09d7da1d8dae05fb04d9016d06d5d964c4cc85dab8f6b032e9",
# "tx": [
# "a68bf0e348915b09d7da1d8dae05fb04d9016d06d5d964c4cc85dab8f6b032e9"
# ],
# "time": 1499790268,
# "mediantime": 1499790268,
# "nonce": 146506294,
# "bits": "1e0ffff0",
# "difficulty": 0.000244140625,
# "chainwork": "0000000000000000000000000000000000000000000000000000000000200020",
# "previousblockhash": "000007acc6970b812948d14ea5a0a13db0fdd07d5047c7e69101fa8b361e05a4",
# "nextblockhash": "00000001d83bf07ff4faddf97a5e68e760f012d6526126b2668aea29bd23bd09"
# }
header_hex = ("02000000" +
"a4051e368bfa0191e6c747507dd0fdb03da1a0a54ed14829810b97c6ac070000" +
"e932b0f6b8da85ccc464d9d5066d01d904fb05ae8d1ddad7095b9148e3f08ba6"
"bcfb6459" +
"f0ff0f1e" +
"3682bb08")
best_hash = '308cf99b4c185248b74052ca614c3fd21dbb47f836628d0eee1be6c409000000'
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.block_header = unhexlify(header_hex)
self.best_hash = best_hash
def test_keccak_hash(self):
self.pow_hash = keccak_hash.getPoWHash(self.block_header)
self.pow_hash = hexlify(self.pow_hash)
self.assertEqual(self.pow_hash, self.best_hash)
if __name__ == '__main__':
unittest.main()