mashape-oauth-4dgy/lib/sha1.js
function rstr_hmac_sha1 (key, data) {
  var bkey = rstr2binb(key);
  if (bkey.length > 16) bkey = binb_sha1(bkey, key.length * 8);

  var ipad = Array(16), opad = Array(16);
  for (var i = 0; i < 16; i++)
    ipad[i] = bkey[i] ^ 0x36363636,
    opad[i] = bkey[i] ^ 0x5C5C5C5C;

  var hash = binb_sha1(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
  return binb2rstr(binb_sha1(opad.concat(hash), 512 + 160));
}
function rstr_hmac_sha1 (key, data) {
  var bkey = rstr2binb(key);
  if (bkey.length > 16) bkey = binb_sha1(bkey, key.length * 8);

  var ipad = Array(16), opad = Array(16);
  for (var i = 0; i < 16; i++)
    ipad[i] = bkey[i] ^ 0x36363636,
    opad[i] = bkey[i] ^ 0x5C5C5C5C;

  var hash = binb_sha1(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
  return binb2rstr(binb_sha1(opad.concat(hash), 512 + 160));
}
Calculate the HMAC-SHA1 of a key and some data (raw strings)