title: How I send a compare a hash in express? server to client
body: <p>I need to answer the client when they ask for a hash from the server which is used to generate and authorize for access to files, how can I confirm that the hash is equal to the message, using node.js and express:</p>
  <pre class="lang-js prettyprint-override"><code>    const express = require(&quot;express&quot;);
      const bodyParser = require(&quot;body-parser&quot;);
      const request = require(&quot;request&quot;);
      const sha1 = require('sha1');
      const app = express();
      app.use(express.static(&quot;public&quot;));
      app.use(bodyParser.urlencoded({extended: true}));
      app.get('/', function(request, response) {
        var x1 = request.query.x1; 
        var x2 = request.query.x2; 
        var x3 = request.query.x3; 
        var x4 = 654321; 
        var hash = sha1(x2+x3+x4)
      });
      app.listen(process.env.PORT || 3000, function() {
        console.log(&quot;Server is running in port 3000!&quot;);
      });
  </code></pre>