title: How to store a password as BCRYPT in a database as '$2a$15' in PHP
body: <p>I am wondering on how to store passwords as <code>BCRYPT</code> that starts with <code>$2a$15</code>, because I have already setup my register and it already stores the passwords in <code>BCRYPT</code>.</p>
  
  <p>However, when it stores the passwords as <code>BCRYPT</code>, the output is <code>$2y$15</code>, but I want it as <code>$2a$15</code>. I am new to <code>BCRYPT</code> and I find it quite hard to understand.</p>
  
  <p>Anyway, here is my <code>BCRYPT</code> code:</p>
  
  <pre><code>function encryptedPassword($strPassword) {
      $strSHA256 = hash('sha256', $strPassword);
      $strBcrypt = password_hash($strSHA256, PASSWORD_BCRYPT, array('cost' =&gt; 15, 'salt' =&gt; bin2hex(openssl_random_pseudo_bytes(12))));
      return $strBcrypt;
  }
  </code></pre>
  
  <p>So, say if my password is <code>Hello123!</code>. The output of that would be:</p>
  
  <pre><code>$2y$15$aa979703a103b0a45b2afO0KS15RjWu5Lc8sa4.xQlsw9QLtyhp/O
  </code></pre>
  
  <p>and I want it to be:</p>
  
  <pre><code>$2a$15$aa979703a103b0a45b2afO0KS15RjWu5Lc8sa4.xQlsw9QLtyhp/O
  </code></pre>
  
  <p>I don't know if this is to do with the salt, can someone help me?</p>