OSDN Git Service

add get_entropy
authorChengcheng Zhang <943420582@qq.com>
Mon, 25 Mar 2019 09:03:27 +0000 (17:03 +0800)
committerChengcheng Zhang <943420582@qq.com>
Mon, 25 Mar 2019 09:03:27 +0000 (17:03 +0800)
README.md
pybtm/__init__.py
pybtm/key.py [new file with mode: 0644]
setup.py

index 4714c1e..2363c74 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,3 +1,16 @@
-# pybtm
+pybtm
+======
+
+- [1 Installation](#1-installation)
+- [2 Usage](#2-usage)
 
 Python3 implementation of the Bytom protocol.
+
+## 1 Installation
+
+```
+$ pip install pybtm
+```
+
+## 2 Usage
+
index 1a31fc9..17d3bec 100644 (file)
@@ -1 +1,2 @@
-name = "pybtm"
\ No newline at end of file
+name = "pybtm"
+version = "0.0.2"
\ No newline at end of file
diff --git a/pybtm/key.py b/pybtm/key.py
new file mode 100644 (file)
index 0000000..5e8e449
--- /dev/null
@@ -0,0 +1,6 @@
+import random
+
+def get_entropy():
+    entropy = random.randint(0, 2**128)
+    entropy_hexstr = entropy.to_bytes(16, byteorder='big').hex()
+    return entropy_hexstr
\ No newline at end of file
index b25cafc..10b8be5 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
 
 setuptools.setup(
     name="pybtm",
-    version="0.0.1",
+    version="0.0.2",
     author="zcc0721",
     author_email="zcc0721@foxmail.com",
     description="Python3 implementation of the Bytom protocol.",