<commit_before><?php

class User
{
	const ADMIN = 1;
	const CLIENT = 2;
	const FRONTDESK = 3;
	const DEV = 4;

	public $id;
	public $clientid;
	public $login;
	public $first;
	public $last;
	public $password;   // <PASSWORD> version
	public $salt;
	public $email;
	public $usertype = self::ADMIN;

	public function encryptPassword($clearPassword) {
		$this->salt = mt_rand();
		$this->password = sha1($this->salt . $clearPassword);
	}

	// Initializes the password to a random value
	public function initPassword() {
		$this->salt = mt_rand();
		$clearPassword = mt_rand();
		$this->password = sha1($this->salt . $clearPassword);
		return $clearPassword;
	}

	public function comparePassword($clearPassword) {
		if ($this->password == sha1($this->salt . $clearPassword))
			return true;
		return false;
	}

	public function fullName() {
		return $this->first . " " . $this->last;
	}

}<commit_msg>Revised hashing in models/user.php to use SHA-512<commit_after><?php

class User {
    
    
    // User types
    const ADMIN = 1;
    const CLIENT = 2;
    const FRONTDESK = 3;
    const DEV = 4;
    
    
    // Class members
    public $id;         // Unique user-id
    public $clientid;   // If this is a client, this is their client-id; otherwise, 0.
                        // (multiple users may have the same client-id)
    public $login;      // Unique username used to login to the website
    public $first;      // First name
    public $last;       // Last name
    public $password;   // <PASSWORD>
    public $salt;       // Password salt
    public $email;      // Email address
    public $usertype = self::ADMIN;  // Type of user; administrator by default
    
    
    // Encrypt a clear-text password by hashing it with SHA-512 and a salt
    public function encryptPassword($clearPassword) {
        $this->salt = mt_rand();
        $this->password = hash('<PASSWORD>', $this->salt . $clearPassword);
    }
    
    
    // Initializes the password to a random value
    public function initPassword() {
        $this->salt = mt_rand();
        $clearPassword = mt_rand();
        $this->password = hash('<PASSWORD>', $this->salt . $clearPassword);
        return $clearPassword;
    }

    // Check to see if a given clear-text password matches this user's password
    public function comparePassword($clearPassword) {
        $hashed_password = hash($this->salt . $clearPassword);
        if ($this->password == $h<PASSWORD>_password) {
            return true;
        } else {
            return false;
        }
    }

    // Get the full name of this user
    public function fullName() {
        return $this->first . " " . $this->last;
    }
    

}
{'fraction_non_alphanumeric': 0.12285287528005974, 'fraction_numerical': 0.006721433905899925, 'mean_word_length': 2.4083969465648853, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 28, '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': '4920993', 'n_tokens_mistral': 854, 'n_tokens_neox': 799, 'n_words': 247}