function weakhash(entity) {
  if (entity.length === 0) {
    // fast-path empty
    return '0-0'
  }

  var len = typeof entity === 'string'
    ? Buffer.byteLength(entity, 'utf8')
    : entity.length

  if (len <= crc32threshold) {
    // crc32 plus length when it's fast
    // crc(str) only accepts utf-8 encoding
    return len.toString(16) + '-' + crc(entity).toString(16)
  }

  // use md4 for long strings
  return crypto
    .createHash('md4')
    .update(entity, 'utf8')
    .digest('base64')
}
Generate a weak hash.

@param {Buffer} entity
@return {String}
@api private