build/authorify.js
function(key, seqNum, record) {
  /* MAC is computed like so:
  HMAC_hash(
    key, seqNum +
      TLSCompressed.type +
      TLSCompressed.version +
      TLSCompressed.length +
      TLSCompressed.fragment)
  */
  var hmac = forge.hmac.create();
  hmac.start('SHA1', key);
  var b = forge.util.createBuffer();
  b.putInt32(seqNum[0]);
  b.putInt32(seqNum[1]);
  b.putByte(record.type);
  b.putByte(record.version.major);
  b.putByte(record.version.minor);
  b.putInt16(record.length);
  b.putBytes(record.fragment.bytes());
  hmac.update(b.getBytes());
  return hmac.digest().getBytes();
}
function(key, seqNum, record) {
  /* MAC is computed like so:
  HMAC_hash(
    key, seqNum +
      TLSCompressed.type +
      TLSCompressed.version +
      TLSCompressed.length +
      TLSCompressed.fragment)
  */
  var hmac = forge.hmac.create();
  hmac.start('SHA1', key);
  var b = forge.util.createBuffer();
  b.putInt32(seqNum[0]);
  b.putInt32(seqNum[1]);
  b.putByte(record.type);
  b.putByte(record.version.major);
  b.putByte(record.version.minor);
  b.putInt16(record.length);
  b.putBytes(record.fragment.bytes());
  hmac.update(b.getBytes());
  return hmac.digest().getBytes();
}
function ( key , seqNum , record ) { /* MAC is computed like so:
  HMAC_hash(
    key, seqNum +
      TLSCompressed.type +
      TLSCompressed.version +
      TLSCompressed.length +
      TLSCompressed.fragment)
  */ var hmac = forge . hmac . create ( ) ; hmac . start ( 'SHA1' , key ) ; var b = forge . util . createBuffer ( ) ; b . putInt32 ( seqNum [ 0 ] ) ; b . putInt32 ( seqNum [ 1 ] ) ; b . putByte ( record . type ) ; b . putByte ( record . version . major ) ; b . putByte ( record . version . minor ) ; b . putInt16 ( record . length ) ; b . putBytes ( record . fragment . bytes ( ) ) ; hmac . update ( b . getBytes ( ) ) ; return hmac . digest ( ) . getBytes ( ) ; }
Gets a MAC for a record using the SHA-1 hash algorithm.

@param key the mac key.
@param state the sequence number (array of two 32-bit integers).
@param record the record.

@return the sha-1 hash (20 bytes) for the given record.
Gets a MAC for a record using the SHA - 1 hash algorithm .