<commit_before>import base64
import hashlib
import os
import pymysql.cursors

from Crypto.Cipher import AES

AES_PASSWORD = "<PASSWORD>"


def sqlWrite(username, mail, password, tenant):
    username_recover = aes_encrypt(username, AES_PASSWORD)
    username = hash_string(username)
    mail = hash_string(mail)
    salt = get_salt()
    api_key = get_api_token()
    api_key_recover = api_key
    api_key = hash_string(api_key)
    password = hash_string(password + salt)
    crypted_password = aes_encrypt(password, AES_PASSWORD)
    tenant = hash_string(tenant)
    sql_write((username, mail, crypted_password,
               salt, tenant, api_key, 0, username_recover, api_key_recover))
    return (api_key_recover)


def sqlUpdate(username, field, search):
    sql_data = sql_query('username', hash_string(username))
    accepted_strings = {"username", "mail", "tenant"}
    if (field in accepted_strings):
        search = hash_string(search)
        sql_data[field] = search
    elif (field == 'password'):
        salt = sql_data["salt"]<commit_msg>Temporary solution<commit_after>import base64
import hashlib
import os
import pymysql.cursors

from Crypto.Cipher import AES

# Temporary solution
AES_PASSWORD = "<PASSWORD>"


def sqlWrite(username, mail, password, tenant):
    username_recover = aes_encrypt(username, AES_PASSWORD)
    username = hash_string(username)
    mail = hash_string(mail)
    salt = get_salt()
    api_key = get_api_token()
    api_key_recover = api_key
    api_key = hash_string(api_key)
    password = <PASSWORD>(password + salt)
    crypted_password = aes_encrypt(password, AES_PASSWORD)
    tenant = hash_string(tenant)
    sql_write((username, mail, crypted_password,
               salt, tenant, api_key, 0, username_recover, api_key_recover))
    return (api_key_recover)


def sqlUpdate(username, field, search):
    sql_data = sql_query('username', hash_string(username))
    accepted_strings = {"username", "mail", "tenant"}
    if (field in accepted_strings):
        search = hash_string(search)
        sql_data[field] = search
    elif (field == 'password'):
        salt = sql_data["salt"]
{'fraction_non_alphanumeric': 0.1005142589995325, 'fraction_numerical': 0.002805049088359046, 'mean_word_length': 4.156626506024097, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5177295', 'n_tokens_mistral': 696, 'n_tokens_neox': 681, 'n_words': 156}