title: javascript convert buffer to a number
body: <p>I have a buffer with size n(assume it's very large and will not have index overflow). I want to hash the first 16 bytes of the buffer and use the hash result as the next location in the buffer to hash the next following 16 bytes, and so on and so forth. This is my first line of code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var newLocation = crypto.createHash("sha256").update(buf.slice(0, 16)).digest()</code></pre>
  </div>
  </div>
  </p>
  
  <p>newLocation is actually a buffer type. I want to know how can I convert it to an index number that I can jump to <code>buf.slice(index, 16)</code> ?</p>