How to use the crc.crc32 function in crc

To help you get started, we’ve selected a few crc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yvele / poosh / packages / poosh-core / src / helpers / options / hash.js View on Github external
let pairs = [];
  forOwn(object, (value, key) => {
    if (value !== undefined && value !== null) {
      pairs.push([key, value]);
    }
  });

  if (!pairs.length) {
    return EMPTY_HASH;
  }

  // Consistant key/value pair ordering
  pairs = sortBy(pairs, pair => pair[0]);

  // eslint-disable-next-line no-magic-numbers
  return crc32(JSON.stringify(pairs)).toString(16);
}
github conveyal / analysis-ui / lib / utils / browsochrones.js View on Github external
async function ensureScenarioLoadedForInstance ({
  bundleId,
  instance,
  modifications,
  scenarioId,
  workerVersion,
  profileRequest,
  updateStatus
}) {
  // hash the modifications to detect any changes that have taken place
  const scenarioHash = crc32(JSON.stringify(modifications))

  // Maybe one day we'll check if anything relevant (the street network) has changed,
  // that would be a performance win
  if (scenarioHash !== instance.scenarioHash || workerVersion !== instance.workerVersion) {
    debug(`scenario ${scenarioId} has changed, updating browsochrones`)
    updateStatus(APPLYING_SCENARIO)
    const scenarioUniqueId = `${scenarioId}-${scenarioHash}`
    const request = getStaticSiteRequest({ modifications, bundleId, scenarioUniqueId, workerVersion, profileRequest })
    // TODO don't duplicate these fields
    const { jobId } = request
    const body = {
      request,
      graphId: bundleId,
      workerVersion,
      jobId
    }
github livestyle / atom / lib / read-file.js View on Github external
return read(uri).then(content => ({
		uri,
		content,
		readTime: Date.now(),
		hash: crc32(content || '')
	}));
}
github FrogTheFrog / steam-gyro-for-cemuhook / src / backend / lib / udp-server / index.ts View on Github external
private finishPacket(data: Buffer) {
        data.writeUInt32LE(crc32(data), 8);
    }
github emmetio / re-view / gulpfile.js View on Github external
function getCRC(filename) {
	return crc.crc32(fs.readFileSync(path.join(output.website, filename), {encoding: 'utf8'}));
}
github doZennn / steam-rom-manager / src / lib / helpers.ts View on Github external
export function generateAppId(executableLocation: string, title: string) {
        //From https://github.com/Hafas/node-steam-shortcuts

        let crcValue = crc.crc32(executableLocation + title);
        let longValue = new long(crcValue, crcValue, true);
        longValue = longValue.or(0x80000000);
        longValue = longValue.shl(32);
        longValue = longValue.or(0x02000000);
        return longValue.toString();
    }
github gobblejs / gobble / src / nodes / Source.js View on Github external
files.forEach( file => {
							const absolutePath = resolve( this.dir, file );
							const buffer = readFileSync( absolutePath );
							const checksum = crc32( buffer );

							this.checksumByFile[ absolutePath ] = checksum;
							this.fileByChecksum[ checksum ] = absolutePath;
						});

crc

Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the browser.

MIT
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis