title: python bcrypt and node.js bcrypt
body: <p>i have a python script that imports user data into a mongodb which uses bcrypt to hash the user's password.</p>
  
  <p>the data will from the mongodb will also be used within a node.js web application, what is the correct way to ensure that the hash generated by the py-bcrypt is the same!</p>
  
  <p>when running the node.js version, i get this:</p>
  
  <pre><code>&gt; bcrypt.genSalt(10, function(err, salt) {
  ... bcrypt.hash("a", salt, function(err, hash) {
  ..... console.log(hash);
  ..... });
  ... });
  undefined
  &gt; $2a$10$tOT8MN1.3gsb6jWVL2hMRe0PHnJnXCxJX9xBewNl.2iRDnZCV/NeC
  </code></pre>
  
  <p>and in python</p>
  
  <pre><code>&gt;&gt;&gt; import bcrypt
  &gt;&gt;&gt; password =b"a"
  &gt;&gt;&gt; hashed = bcrypt.hashpw(password, bcrypt.gensalt(10))
  &gt;&gt;&gt; hashed
  '$2a$10$RzKqQppa3Y7ZZV8f7Ay5COFB5GMEGu7aLH7Fe2HchCyYF1gWVMZ/m'
  </code></pre>
  
  <p>comparing the hash in python using the hash generated by node, returns:</p>
  
  <pre><code>&gt;&gt;&gt; node_hash = b"$2a$10$tOT8MN1.3gsb6jWVL2hMRe0PHnJnXCxJX9xBewNl.2iRDnZCV/NeC"
  &gt;&gt;&gt; if bcrypt.hashpw(password, node_hash) == node_hash:
  ...     print("It Matches!")
  ... else:
  ...     print("Does not match")
  ... 
  It Matches!
  </code></pre>
  
  <p>is there a way to create a bcrypt hash in python to be used in a node.js application?</p>