<commit_before>import hashlib

from character import Warrior
from rooms import *
from banner import bannerText

# empty list for tracking all players
players = {}

# ansi escape color codes
color = {
    "black": u"\u001b[30;1m",
    "red": u"\u001b[31;1m",
    "green": u"\u001b[32;1m",
    "yellow": u"\u001b[33;1m",
    "blue": u"\u001b[34;1m",
    "magenta": u"\u001b[35;1m",
    "cyan": u"\u001b[36;1m",
    "white": u"\u001b[37;1m",
    "reset": u"\u001b[0m"

}

def login_check(mud,id,command):
    """
    Reads the server password hash file and compares the user provided
    password against it. The user's authentication status will be set to True
    once the correct password is entered.
    """

    # Get server hash from pass file.
    file_conn = open('pass', 'r')
    serverSecret = file_conn.readline()
    file_conn.close()

    # Compare user provide password against the stored hash
    hashResult = hashlib.sha224(command).hexdigest()
    if hashResult != serverSecret:
        mud.send_message(id, "Sorry, you provided an incorrect password.")
    else:
        players[id].authenticated = mud.authentication_status(id,True)
        mud.send_message(id, "Welcome!")
        mud.send_message(id, "What is your name?")

def new_players_check(mud):
    """
    Checks to see if there are new players that have joined the server.
    Displays a banner and adds the user to the list of players.<commit_msg>Fixed the reference to the password file since moving within the data directory.<commit_after>import hashlib

from character import Warrior
from rooms import *
from banner import bannerText

# empty list for tracking all players
players = {}

# ansi escape color codes
color = {
    "black": u"\u001b[30;1m",
    "red": u"\u001b[31;1m",
    "green": u"\u001b[32;1m",
    "yellow": u"\u001b[33;1m",
    "blue": u"\u001b[34;1m",
    "magenta": u"\u001b[35;1m",
    "cyan": u"\u001b[36;1m",
    "white": u"\u001b[37;1m",
    "reset": u"\u001b[0m"

}

def login_check(mud,id,command):
    """
    Reads the server password hash file and compares the user provided
    password against it. The user's authentication status will be set to True
    once the correct password is entered.
    """

    # Get server hash from pass file.
    file_conn = open('data/pass', 'r')
    serverSecret = file_conn.readline()
    file_conn.close()

    # Compare user provide password against the stored hash
    hashResult = hashlib.sha224(command).hexdigest()
    if hashResult != serverSecret:
        mud.send_message(id, "Sorry, you provided an incorrect password.")
    else:
        players[id].authenticated = mud.authentication_status(id,True)
        mud.send_message(id, "Welcome!")
        mud.send_message(id, "What is your name?")

def new_players_check(mud):
    """
    Checks to see if there are new players that have joined the server.
    Displays a banner and adds the user to the list of players.
{'fraction_non_alphanumeric': 0.11841204654346338, 'fraction_numerical': 0.03764544832306639, 'mean_word_length': 3.4087481146304675, 'pattern_counts': {'":': 18, '<': 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': '5177556', 'n_tokens_mistral': 1022, 'n_tokens_neox': 937, 'n_words': 297}