@@ -0,0 +1,1978 @@
+%22%22%22This module crypts the message of ping%22%22%22%0A%0Afrom __future__ import division%0Afrom string import ascii_lowercase%0A%0Asymbols = list('0123456789')%0Asymbols.append(' ')%0Afor i in ascii_lowercase:%0A    symbols.append(i)%0Asymbols.extend(list(',.-_#@!()'))%0A%0Adef _convert_to_symbols(message):%0A    %22%22%22%0A    Convert a list of characters into a list of integers using the symbols%0A    list.%0A%0A    Parameters%0A    ----------%0A    message : list of characters%0A      The characters present in the message to encrypt%0A%0A    Returns%0A    -------%0A    message : converted message%0A      A list of integers which symbolically represent characters%0A    %22%22%22%0A    for i in range(len(message)):%0A        message%5Bi%5D = symbols.index(message%5Bi%5D)%0A%0A    return message%0A%0A%0Adef encrypt(message, key):%0A    %22%22%22%0A    Encrypt a message using a key of string%0A%0A    Parameters%0A    ----------%0A    key : string%0A      The password hash of the user stored%0A%0A    message : string%0A      Message to be encrypted%0A%0A    Returns%0A    -------%0A    new_message : list of integers%0A      Integers obtained from %60_convert_to_symbols%60%0A    %22%22%22%0A    message = message.lower()%0A    if len(key) %3C len(message):%0A        key = key*(len(message)//len(key) + 1)%0A    message = list(message)%0A    message = _convert_to_symbols(message)%0A    new_message = message%5B:%5D%0A    for i in range(len(message)):%0A        new_message%5Bi%5D += symbols.index(key%5Bi%5D)%0A%0A    return new_message%0A%0A%0Adef decrypt(message, key):%0A    %22%22%22%0A    Decrypt a message in the form of a list of integers%0A%0A    Parameters%0A    ----------%0A    message : list of integers%0A      This is generated from the %60encrypt%60 function%0A    key : string%0A      The key which was used in encryption%0A%0A    Returns%0A    -------%0A    new_message = string%0A      The decrypted message%0A    %22%22%22%0A    if len(key) %3C len(message):%0A        key = key*(len(message)//len(key) + 1)%0A    new_message = message%5B:%5D%0A    for i in range(len(message)):%0A        new_message%5Bi%5D = symbols%5Bmessage%5Bi%5D - symbols.index(key%5Bi%5D)%5D%0A%0A    return ''.join(new_message)%0A

Implement a simple cryptography functions using a key