-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexample.py
More file actions
26 lines (18 loc) · 718 Bytes
/
Copy pathexample.py
File metadata and controls
26 lines (18 loc) · 718 Bytes
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
"""Example for EIP 1577 content hash."""
import content_hash
def main():
"""Handle example."""
# Get codec of content hash
chash = "e6013148654c4c6f34757a6a614c65744678364e4833504d774650337162526254663344"
codec = content_hash.get_codec(chash)
print("Codec of content hash:", codec)
# Decode content hash
chash = "e6013148654c4c6f34757a6a614c65744678364e4833504d774650337162526254663344"
address = content_hash.decode(chash)
print("Decoded content hash:", address)
# Encode content hash
address = "1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D"
chash = content_hash.encode("zeronet", address)
print("Encoded content hash:", chash)
if __name__ == "__main__":
main()