code: public function generateUserPassword(User $user, $password, $generateOld = false)
      {
          $registrationDate = $user->RegDate;
  
          $pre = $this->encode($registrationDate);
          $pos = substr($registrationDate, 5, 1);
          $post = $this->encode($registrationDate * (substr($registrationDate, $pos, 1)));
  
          $finalString = $pre . $password . $post;
  
          return $generateOld ? md5($finalString) : sha1($finalString);
      }
docs: Generate a password for a user
  
  @param User   $user
  @param String $password - Clear text password
  @param bool   $generateOld
  
  @return string