title: SHA 512 hashing and verifying
body: <p>Alright so Im trying to verify password with SHA 512, but no matter what it still returns false like the hash check is not correct.</p>
  
  <p>Generating hash when registering</p>
  
  <pre><code>$hashed = password_hash(hash('sha512', $password), PASSWORD_DEFAULT);
  </code></pre>
  
  <p>And to verify (upon login) I use simple </p>
  
  <pre><code>public function isValidLogin($username, $password) {
      $sql = $this-&gt;connect();
      $sql-&gt;real_escape_string($username);
      $sql-&gt;real_escape_string($password);
  
      $res = $sql-&gt;query("SELECT password FROM users WHERE name='".$username."'");
  
      if ($res-&gt;num_rows &gt;= 1) {
          while($row = $res-&gt;fetch_assoc()) {
              if (password_verify(hash('sha512', $password), $row['password'])) {
                  return true;
              }
          }
      }
  
      return false;
  }
  </code></pre>