summaryrefslogtreecommitdiff
path: root/cli/app/utils/util.py
blob: 5f720881f310f0b99bc6574f12c7edc56e88b888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)