# Secure Layer ## A mechanism to secure server client communication This library is a simple mechanism a web server developer can employ in order to secure communications between client and server. The main idea behind it is to have a "rolling shared key", meaning a key that constantly changes in an unpredictable way yet is securely shared between server and client. To achieve this, the client and the server first share a key once, this is called in code the "init_key_hash" and is generated by the function start_session, after that the client encrypts his message using this key and sends the cipher text to the server and after that modifies his own key by concatenating the plain text to the original key and hashing the result. The server received the cipher_text and decrypts with the original key, then modifies his own key in the same manner using the decrypted plain text. The result is that both client and server have the same new key without exchanging the key over the network in any way. Notice that the server must successfully decrypt the cipher text in order to acquire the new key, also the replication of the process by a third party get more difficult over time meaning to generate the same key one would have to follow the initial key and all of the following plain text exchanged between the client and the server. ## How to use See test function at the bottom of lib.rs