summaryrefslogtreecommitdiff
path: root/cli/app/utils/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/app/utils/util.py')
-rw-r--r--cli/app/utils/util.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/app/utils/util.py b/cli/app/utils/util.py
new file mode 100644
index 0000000..5f72088
--- /dev/null
+++ b/cli/app/utils/util.py
@@ -0,0 +1,15 @@
+import simplejson as json
+from hashlib import sha256
+
+def sha256(s):
+ sha256 = hashlib.sha256()
+ sha256.update(s)
+ return sha256.hexdigest()
+
+def read_json(fn):
+ with open(fn, 'r') as json_file:
+ return json.load(json_file)
+
+def write_json(fn, data):
+ with open(fn, 'w') as outfile:
+ json.dump(data, outfile)