function generateS2(messageFormat, clientsig) {
  let randomBytes = crypto.randomBytes(RTMP_SIG_SIZE - 32);
  let challengeKeyOffset;
  if (messageFormat === 1) {
    challengeKeyOffset = GetClientGenuineConstDigestOffset(clientsig.slice(8, 12));
  } else {
    challengeKeyOffset = GetServerGenuineConstDigestOffset(clientsig.slice(772, 776));
  }
  let challengeKey = clientsig.slice(challengeKeyOffset, challengeKeyOffset + 32);
  let hash = calcHmac(challengeKey, GenuineFMSConstCrud);
  let signature = calcHmac(randomBytes, hash);
  let s2Bytes = Buffer.concat([randomBytes, signature], RTMP_SIG_SIZE);
  return s2Bytes;
}
@param {number} messageFormat
@param {Buffer} clientsig
@returns {Buffer}