<commit_before>#!/usr/bin/env python

# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

from __future__ import print_function
import time
import select
import os
import sys
import socket
import hashlib
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor, protocol, endpoints, task

### Protocol Implementation

class Echo(LineReceiver):
    alive = True
    inputs = []
    # A mapping of public ids to private ids. Should be put into seperate file.
    authkeys = {'test':'qwerty123'}

    def authenticate(self, data):
        """
            Authenticates data using an md5 hash.
            Expects a string of format publicid % message % md5(message+privateid)
        """

        data = data.strip().split('%')
        if len(data) != 3:
            raise Exception("Invalid Message")
        try:
            salt = self.authkeys[data[0]].encode('utf-8','ignore')
        except:
            raise Exception("Invalid Authkey")
        message = data[1].encode('utf-8','ignore')
        checksum = hashlib.md5(message+salt).hexdigest()
        if data[2] == checksum:<commit_msg>Changed variable name for consistency<commit_after>#!/usr/bin/env python

# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

from __future__ import print_function
import time
import select
import os
import sys
import socket
import hashlib
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor, protocol, endpoints, task

### Protocol Implementation

class Echo(LineReceiver):
    alive = True
    inputs = []
    # A mapping of public ids to private ids. Should be put into seperate file.
    authkeys = {'test':'qwerty123'}

    def authenticate(self, data):
        """
            Authenticates data using an md5 hash.
            Expects a string of format publicid % message % md5(message+privateid)
        """

        data = data.strip().split('%')
        if len(data) != 3:
            raise Exception("Invalid Message")
        try:
            privateid = self.authkeys[data[0]].encode('utf-8','ignore')
        except:
            raise Exception("Invalid Authkey")
        message = data[1].encode('utf-8','ignore')
        checksum = hashlib.md5(message+privateid).hexdigest()
        if data[2] == checksum:
{'fraction_non_alphanumeric': 0.10517241379310345, 'fraction_numerical': 0.010344827586206896, 'mean_word_length': 2.9008403361344537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3661039', 'n_tokens_mistral': 656, 'n_tokens_neox': 624, 'n_words': 203}