SHA256 and classic ASP VBSCRIPT for intercom.io secure settings and others

I've recently been using intercom.io to manage my member communication and they require a secure mode to be enabled that passes a hashed value with each session.

On the back end I needed to create javascript that looked like this:

The user hash needed to be a SHA256 hash of the users email address and the unique "salt" or secret key provided by intercom.io on a user account basis.

The problem was that I'm using Vbscript/classic ASP so was having trouble sorting this out with the limited VBScript library.

The solution was found courtesy of:

 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
 * in FIPS 180-2
 * Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for details.
 * Adapted into a WSC for use in classic ASP by Daniel O'Malley
 * (based on an SHA-1 example by Erik Oosterwaal)
 * for use with the Amazon Product Advertising API

Basically you create a stand alone file called sha256.wsc that lives in the same directory as the function - then pass in the appropriate variables.

VBScript Function:

The contents for sha256.wsc follow at the end of the post. Good luck and happy coding


  1. This comment has been removed by the author.

  2. I've been using this for several years and just discovered a bug in the code.
    output = encoding[0] + output;
    needs to be changed to
    output = encoding.charAt(0) + output;

  3. Great thanks for sharing this article. Much thanks again. Cool.hospitality wifi solution

  4. SketchUp Pro Crack is a 3D plan programming that permits you to draw outlines, 3D items, computer games, and other plan objects. Sketchup Free License

  5. Thursday Wishes, Quotes and Greetings. Free Thursday images for whatsapp collection. You will find below a curated collection of good morning images Thursday Quotes