import socket
import json


def receive_message(json_message):
    message = json.loads(json_message)
    return message


def send_message(message):
    json_message = json.dumps(message)
    return json_message


def create_socket(socket_name, init=False):
    s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    if init:
        s.bind("/tmp/" + str(socket_name))
        s.listen(1)
    else:
        s.connect("/tmp/" + str(socket_name))
    return s

@@ -19,16 +19,31 @@
 rt json%0A
+import hashlib%0A
 %0A%0Adef re
@@ -470,8 +470,103 @@
 eturn s%0A
+%0A%0Adef hash_fun(node_id):%0A    m = hashlib.sha1()%0A    m.update(node_id)%0A    return m.hexdigest()%0A

Add hash functionality.