how to use nodejs crypto module in javascript

Is there any way i can use nodejs "crypto" module in javascript without actually using node.

Or is there any similar javascript library that does all the things that "crypto" does

Like i neeed the below code in javascript with the help of nodejs

  var crypto = require('crypto'),
     hash = crypto.createHash('sha256'),
     hmac = crypto.createHmac('sha256', someKey);

basically i need to replicate below in javascript without using node at all

var bytesToSign = hash.update(stringToSign).digest();

node.js crypto module is based on openssl library

you can try this native js implementation of sha256 digest